register method
Register a listener on an event type
To have a widget's EventManager listen to an Event you must register a listener in the didChangeDependencies() and didUpdateWidget() in its _ViewState
Implementation
register(EventTypes type, OnEventCallback callback, {int? priority}) {
if (!listeners.containsKey(type)) listeners[type] = [];
int i = listeners[type]!.length;
if ((priority != null) && (priority >= 0) && (priority <= i)) i = priority;
if (!listeners[type]!.contains(callback)) {
listeners[type]!.insert(i, callback);
}
}