addEvent property
dynamic Function(BlocEvent)
get
addEvent
Notifies the BloC of a new event which triggers mapEventToState
.
If dispose
has already been called, any calls to dispatchEvent
will be ignored and will not result in any state changes.
For example:
bloc.dispatchEvent(blocEvent);
Implementation
Function(BlocEvent) get addEvent {
// We should use a new Future (() => dispatch) in order to add the task
// to the end of the event loop.
if (!isClosed) {
return internalEventController.sink.add;
} else if (kDebugMode) {
log('[$runtimeType]: try to dispatchEvent on a disposed bloc');
}
return _addEvent;
}