|
|
@ -2,12 +2,14 @@ part of '../../settings.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class OptionDisableException implements Exception {} |
|
|
|
class OptionDisableException implements Exception {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@immutable |
|
|
|
abstract class Option<T> { |
|
|
|
abstract class Option<T> { |
|
|
|
Option({ |
|
|
|
Option({ |
|
|
|
required this.storage, |
|
|
|
required this.storage, |
|
|
|
required this.key, |
|
|
|
required this.key, |
|
|
|
required this.label, |
|
|
|
required this.label, |
|
|
|
required this.defaultValue, |
|
|
|
required this.defaultValue, |
|
|
|
|
|
|
|
required this.stream, |
|
|
|
this.category, |
|
|
|
this.category, |
|
|
|
final BehaviorSubject<bool>? enabled, |
|
|
|
final BehaviorSubject<bool>? enabled, |
|
|
|
}) : enabled = enabled ?? BehaviorSubject<bool>.seeded(true); |
|
|
|
}) : enabled = enabled ?? BehaviorSubject<bool>.seeded(true); |
|
|
@ -18,8 +20,8 @@ abstract class Option<T> { |
|
|
|
final T defaultValue; |
|
|
|
final T defaultValue; |
|
|
|
final OptionsCategory? category; |
|
|
|
final OptionsCategory? category; |
|
|
|
final BehaviorSubject<bool> enabled; |
|
|
|
final BehaviorSubject<bool> enabled; |
|
|
|
|
|
|
|
final BehaviorSubject<T> stream; |
|
|
|
|
|
|
|
|
|
|
|
late BehaviorSubject<T> stream; |
|
|
|
|
|
|
|
T get value { |
|
|
|
T get value { |
|
|
|
if (hasValue) { |
|
|
|
if (hasValue) { |
|
|
|
return stream.value; |
|
|
|
return stream.value; |
|
|
|