removeObserver method

void removeObserver(
  1. CellObserver observer
)

Remove an observer, so that it is no longer notified of changes in the value of the cell.

If this is the last observer that is being removed, dispose is called and isDisposed will return true. After that this state object should no longer be used, and a new state object should be created if the cell is still used.

Implementation

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

  final count = _observers[observer];

  if (count != null) {
    if (count > 1) {
      _observers[observer] = count - 1;
    }
    else {
      _observers.remove(observer);

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