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, required this.defaultValue,
this.category, this.category,
final BehaviorSubject<bool>? enabled, final BehaviorSubject<bool>? enabled,
}) : assert(defaultValue.hasValue, 'When using defaultValue the stream has to be seeded') { }) : enabled = enabled ?? BehaviorSubject<bool>.seeded(true),
if (enabled != null) { assert(defaultValue.hasValue, 'When using defaultValue the stream has to be seeded');
this.enabled = enabled;
} else {
this.enabled = BehaviorSubject<bool>.seeded(true);
}
}
final SettingsStorage storage; final SettingsStorage storage;
final String key; final String key;
final LabelBuilder label; final LabelBuilder label;
final BehaviorSubject<T> defaultValue; final BehaviorSubject<T> defaultValue;
final OptionsCategory? category; final OptionsCategory? category;
late final BehaviorSubject<bool> enabled; final BehaviorSubject<bool> enabled;
late BehaviorSubject<T> stream; late BehaviorSubject<T> stream;
T get value { T get value {

Loading…
Cancel
Save