IBlocSink<Event extends Object?> class abstract

A Bloc Sink interface that accepts events both synchronously and asynchronously.

The IBlocSink methods can't be used while the addStream is called. As soon as the addStream's Future completes with a value, the EventSink methods can be used again.

If addStream is called after any of the EventSink methods, it'll be delayed until the underlying system has consumed the data added by the EventSink methods.

When EventSink methods are used, the done Future can be used to catch any errors.

When close is called, it will return the done Future.

Implemented types
Implementers

Constructors

IBlocSink()

Properties

done Future<void>
Return a future which is completed when the IBlocSink is finished.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Event event) → void
Notifies the Bloc of a new event If close has already been called, any subsequent calls to add will be ignored and will not result in any subsequent state changes.
override
addError(Object error, [StackTrace? stackTrace]) → void
Reports an error which triggers onError with an optional StackTrace. If close has already been called, any subsequent calls to addError will be ignored and will not result in any subsequent state changes.
override
addStream(Stream<Event> eventStream) Future<void>
Pass all eventStream events to the Bloc If close has already been called, any subsequent calls to addStream will be ignored and will not result in any subsequent state changes.
override
close() Future<void>
Closes the event and state Streams. This method should be called when a Bloc is no longer needed. Once close is called, events that are added will not be processed. In addition, if close is called while events are still being processed, the Bloc will finish processing the pending events.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies IBlocObserver.onError.
onEvent(Event event) → void
Called whenever an event is added to the Bloc. A great spot to add logging/analytics at the individual Bloc level.
toString() String
A string representation of this object.
inherited

Operators

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