addObserver method

void addObserver(
  1. CellObserver observer
)

Add an observer which is notified of changes in the value of the cell.

If this is the first observer that is being added, init is called.

Implementation

void addObserver(CellObserver observer) {
  assert(!_isDisposed);

  if (_observers.isEmpty) {
    init();
  }

  _observers.update(observer, (count) => count + 1, ifAbsent: () => 1);
}