remove method

bool remove(
  1. void listener()
)

Deactivates and removes the earliest active registration of listener.

Returns true if a registration was found and removed, or false otherwise.

Implementation

bool remove(void Function() listener) {
  for (var i = 0; i < _entries.length; i++) {
    final entry = _entries[i];
    // No test of `alive` here: a deactivated entry is taken out of the
    // list in the same breath, so the list holds live ones only. The
    // flag is for the snapshot `notify` walks, which is not this list.
    if (entry.listener == listener) {
      entry.alive = false;
      _entries.removeAt(i);
      return true;
    }
  }
  return false;
}