OmegaEventName class abstract

Contract for typed event names (avoids magic strings and eases refactoring).

Implement this interface with an enum or class to define your app's known events and use OmegaEvent.fromName when emitting. You get autocomplete and the analyzer catches broken usages when you change the name.

Example with enum:

enum AppEvent implements OmegaEventName {
  authLoginSuccess('auth.login.success'),
  userUpdated('user.updated'),
  navigateHome('navigate.home');
  const AppEvent(this.name);
  @override
  final String name;
}
// Usage: channel.emit(OmegaEvent.fromName(AppEvent.authLoginSuccess, payload: user));
Implementers

Constructors

OmegaEventName()

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
Event name (e.g. "auth.login.success").
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited