StreamValue<T> constructor

StreamValue<T>(
  1. T value, {
  2. OnUpdate<T>? onUpdate,
})

A observable object that notifies its subscribers when its value has been modified.

value is the initial value.

onUpdate is a synchronous event called each time the value is modified.

Warning: Updating the value directly from within onUpdate will cause onUpdate to be called endlessly, triggering a stack overflow, instead the setValue method must be used to update the value without notifying the listeners or triggering onUpdate.

Implementation

StreamValue(T value, {this.onUpdate}) : _value = value;