observe method

  1. @override
Dispose observe (
  1. Listener<ListChange<T>> listener,
  2. {bool fireImmediately}
)
override

Attach a listener to the changes happening in the list.

You can choose to receive the change notification immediately (with fireImmediately) or on the first change

Implementation

@override
Dispose observe(Listener<ListChange<T>> listener, {bool fireImmediately}) {
  if (fireImmediately == true) {
    final change = ListChange(list: this, rangeChanges: <RangeChange>[
      RangeChange(index: 0, newValues: toList(growable: false))
    ]);
    listener(change);
  }

  return _listeners.add(listener);
}