observe method

  1. @override
Dispose observe(
  1. MapChangeListener<K, V> listener, {
  2. bool fireImmediately = false,
})
override

Used to attach a listener for getting notified on changes happening to the map

You can also choose to receive the notifications immediately (with fireImmediately)

Implementation

@override
Dispose observe(MapChangeListener<K, V> listener,
    {bool fireImmediately = false}) {
  if (fireImmediately == true) {
    _map.forEach((key, value) {
      listener(MapChange<K, V>(
        type: OperationType.add,
        key: key,
        newValue: value,
        object: this,
      ));
    });
  }
  return _listeners.add(listener);
}