ComputedValueNotifier<T> constructor

ComputedValueNotifier<T>({
  1. required Listenable listenable,
  2. required T compute(),
})

Computed value based on another listenable

Implementation

ComputedValueNotifier({
  required Listenable listenable,
  required T Function() compute,
})  : _listenable = listenable,
      _compute = compute,
      _value = compute() {
  _listenable.addListener(_updateValue);
}