ComputedNotifier<T> constructor

ComputedNotifier<T>(
  1. T compute(), {
  2. required List<ChangeNotifier> depends,
})

Creates a ComputedNotifier.

The compute function should return the value.

The depends list should contain all of the notifiers that the value depends on.

Implementation

ComputedNotifier(this.compute, {required this.depends}) {
  _onChange = oneCallTask(() {
    _value = compute();
    notifyListeners();
  });
}