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(
        object: this,
        index: 0,
        type: OperationType.add,
        added: toList(growable: false));
    listener(change);
  }

  return _listeners.add(listener);
}