Mediator class

Core mediator

Constructors

Mediator(Pipeline pipeline)

Properties

eventFuncHandler Map<Type, List<FuncEventHandler<IDomainEvent>>>
final
eventHandlers Map<Type, List<IEventHandler<IDomainEvent>>>
final
handlers Map<Type, HandlerCreator>
final
hashCode int
The hash code for this object.
no setterinherited
pipeline Pipeline
Add pipeline behaviors that will be called with each request send through the mediator instance.
final
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
publish<E extends IDomainEvent>(E event) Future<void>
Publishes an event to both function and class subscribers.
registerHandler<IR extends IRequest<R>, R, H extends IRequestHandler<IR, R>>(HandlerCreator<H> creator) → void
creator should be a function that creates a IRequestHandler R is the return type of the request handler IR is the IRequest type H is the type of the IRequestHandler, the return type of the creator
send<T extends IRequest<R>, R extends Object?>(T request) Future<R>
Sends a request to the given handlers after passing it through all middleware.
subscribe<E extends IDomainEvent>(IEventHandler<E> handler) → void
Call subscribe to register to IDomainEvents with a class That implements IEventHandler if you do not wish to register with a function.
subscribeWithFunc<E extends IDomainEvent>(FutureOr<void> func(IDomainEvent event)) UnsubscribeFunc
Called subscribe with func to register to IDomainEvents with a function that will receive the event. You can add as many subscribers as you want.
toString() String
A string representation of this object.
inherited
unsubscribe<E extends IDomainEvent>(IEventHandler<E> handler) → void
Unsubscribes a class from the given Event

Operators

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