Browse Source

settings: cleanup option

pull/389/head
Nikolas Rimikis 1 year ago
parent
commit
6be1442816
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 11
      packages/settings/lib/src/options/option.dart

11
packages/settings/lib/src/options/option.dart

@ -10,20 +10,15 @@ abstract class Option<T> {
required this.defaultValue,
this.category,
final BehaviorSubject<bool>? enabled,
}) : assert(defaultValue.hasValue, 'When using defaultValue the stream has to be seeded') {
if (enabled != null) {
this.enabled = enabled;
} else {
this.enabled = BehaviorSubject<bool>.seeded(true);
}
}
}) : enabled = enabled ?? BehaviorSubject<bool>.seeded(true),
assert(defaultValue.hasValue, 'When using defaultValue the stream has to be seeded');
final SettingsStorage storage;
final String key;
final LabelBuilder label;
final BehaviorSubject<T> defaultValue;
final OptionsCategory? category;
late final BehaviorSubject<bool> enabled;
final BehaviorSubject<bool> enabled;
late BehaviorSubject<T> stream;
T get value {

Loading…
Cancel
Save