unsubscribe method

bool unsubscribe(
  1. String key
)

Removes a handler previously added to this Event.

Returns true if handler was in list, false otherwise. This method has no effect if the handler is not in the list.

Implementation

bool unsubscribe(String key) {
  if (!_handlers.containsKey(key)) {
    print('Key ' + key + " is not subscribed.");
    return false;
  }

  _handlers.remove(key);
  return true;
}