|
|
@ -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 { |
|
|
|