mirror of
https://github.com/flutter/samples.git
synced 2026-04-19 13:32:43 +00:00
[linting_tool] Implement editing profile (#874)
This commit is contained in:
committed by
GitHub
parent
bd4fa28584
commit
1e00fd0bde
@@ -76,6 +76,21 @@ class ProfilesStore extends ChangeNotifier {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> updateProfile(
|
||||
RulesProfile oldProfile, RulesProfile newProfile) async {
|
||||
await HiveService.updateBox<RulesProfile>(oldProfile, newProfile, _boxName);
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 100), () async {
|
||||
await fetchSavedProfiles();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> removeRuleFromProfile(RulesProfile profile, Rule rule) async {
|
||||
var newProfile =
|
||||
RulesProfile(name: profile.name, rules: profile.rules..remove(rule));
|
||||
await updateProfile(profile, newProfile);
|
||||
}
|
||||
|
||||
Future<void> deleteProfile(RulesProfile profile) async {
|
||||
await HiveService.deleteBox<RulesProfile>(profile, _boxName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user