QudsValue<T> constructor

QudsValue<T>({
  1. required String name,
  2. required T value,
  3. bool? serializable,
  4. T jsonGetter(
    1. Map<String, dynamic> json
    )?,
})

name: the key name of the value, must be unique

value: an initial value

serializable: set weather the value can be serialized for saving and restoring.

Implementation

QudsValue(
    {required this.name,
    required T value,
    this.serializable,
    this.jsonGetter}) {
  _isListNotifier = value is QudsListNotifier;
  if (_isListNotifier)
    _listNotifier = value as QudsListNotifier;
  else
    _valueNotifier = ValueNotifier<T>(value);
  _valueNotifier?.addListener(_onChange);
  _listNotifier?.addWatcher(_onChange);
}