removeStringFromPrefList function
- BuildContext context, {
- required PreferenceStringListProvider provider,
- required String value,
Remove a string value from a string list preference
Implementation
Future<bool> removeStringFromPrefList(
BuildContext context, {
required PreferenceStringListProvider provider,
required String value,
}) async {
final container = ProviderScope.containerOf(context);
final notifier = container.read(provider.notifier);
final values = notifier.getValue().where((prefValue) => prefValue != value);
return await notifier.setValue(values.toList());
}