A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
574 B

part of '../../settings.dart';
class ToggleOption extends Option<bool> {
ToggleOption({
required super.storage,
required super.key,
required super.label,
required super.defaultValue,
super.category,
super.enabled,
}) {
stream = BehaviorSubject.seeded(storage.getBool(key) ?? defaultValue.value);
}
@override
Future set(final bool value) {
stream.add(value);
return storage.setBool(key, value);
}
@override
bool serialize() => value;
@override
Future<bool?> deserialize(final dynamic data) async => data as bool;
}