EventBus class

Inheritance

Constructors

EventBus()
factory

Properties

eventHistory → List<ModuleEvent>
Get all event history
no setter
eventMiddlewareCount → int
Get current middleware counts for debugging and monitoring.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
signalHistory → List<SignalHistoryEntry>
Get all signal history
no setter
signalMiddlewareCount → int
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addMiddleware(EventMiddleware middleware) → void
Add an event middleware for processing or filtering events.
addSignalMiddleware(SignalMiddleware middleware) → void
Add a signal middleware for processing or filtering named signals.
cancel(EventSubscription subscription) → void
Cancel a specific subscription
cancelModuleSubscriptions(String moduleId) → void
Cancel all subscriptions from a module
clearAll() → void
Clears all subscriptions and histories.
dispose() → void
Dispose resources
override
emit<T extends ModuleEvent>(T event) → void
Emit an event to all subscribers with built-in rate limiting protection.
emitAsync<T extends ModuleEvent>(T event) → Future<void>
Emit an event asynchronously (non-blocking)
emitSignal(String signalName, {dynamic data, String? sourceModuleId, ModuleIdentityToken? identityToken}) → void
Emit a named signal with identity verification and rate limiting.
getRecentEvents<T extends ModuleEvent>({int limit = 10}) → List<T>
Get recent events of a specific type
hasSubscribers<T extends ModuleEvent>() → bool
Check if there are subscribers for an event type
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
on<T extends ModuleEvent>(void callback(T event), {String? subscriberModuleId, Duration? timeout}) → EventSubscription
Subscribe to events of a specific type Returns a subscription that can be cancelled
onAutoDispose<T extends ModuleEvent>(void callback(T event), {String? subscriberModuleId, Duration? timeout}) → EventSubscription
Subscribe to events and auto-dispose when widget is disposed Use with StatefulWidget's dispose method
onSignal(String signalName, void callback(dynamic), {String? subscriberModuleId, Duration? timeout}) → EventSubscription
Subscribe to a named signal (String-based event) Use this for zero-import communication between modules
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeMiddleware(EventMiddleware middleware) → void
Remove an event middleware from the chain.
removeSignalMiddleware(SignalMiddleware middleware) → void
Remove a signal middleware from the chain.
setRateLimitConfig(RateLimitConfig config) → void
Configure rate limiting
subscriberCount<T extends ModuleEvent>() → int
Get subscriber count for an event type
toString() → String
A string representation of this object.
inherited

Operators

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