dispatchEvent static method
Dispatch event on given type with payload.
Since we use LinkedHashSet to store listeners internally, so all listeners will be called in the order they are added.
Implementation
static dispatchEvent(String type, [Object? payload]) {
final listeners = _registry[type];
if (listeners != null) {
for (final listener in listeners) {
listener(payload);
}
}
}