GgValue<T> constructor

GgValue<T>({
  1. required T seed,
  2. bool spam = false,
  3. bool compare(
    1. T a,
    2. T b
    )?,
  4. T transform(
    1. T
    )?,
  5. bool isOk(
    1. T
    )?,
  6. T parse(
    1. String
    )?,
  7. String stringify(
    1. T
    )?,
  8. String? name,
})
  • seed The initial seed of the value.
  • If spam is true, each change of the value will be added to the stream.
  • If spam is false, updates of the value are scheduled as micro tasks. New updates are not added until the last update has been delivered. Only the last set value will be delivered.
  • transform allows you to keep value in a given range or transform it.
  • parse is needed when T is not String, int, double or bool. It converts a string into T.
  • stringify is needed when T is not String, int, double or bool. It converts the value into a String.
  • name is an optional identifier for the value.

Implementation

GgValue({
  required T seed,
  this.spam = false,
  this.compare,
  this.transform,
  this.isOk,
  T Function(String)? parse,
  String Function(T)? stringify,
  this.name,
})  : _value = seed,
      _seed = seed,
      _parse = parse,
      _stringify = stringify {
  _initController();
  _initSync();
}