Bloc<T> class

Business Logic Component

Constructors

Bloc(T initialState, Map<Type, Future<T> Function(T state(), Object, void updateState(T), Object? pageScope)> _handlersByEvent, Map<Type, T Function(T state, Object event)> _syncHandlersByEvent, {Object? pageScope})
You can construct a Bloc here, but you're probably better off using a BlocBuilder

Properties

hashCode int
The hash code for this object.
no setterinherited
initialState → T
The initial state of the bloc
final
pageScope Object?
Put short lived objected that need disposal here
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<Snapshot<T>>
The stream of state updates. Listen to this with a StreamBuilder
no setter

Methods

addEvent(BlocEvent event) Future<void>
Send an async event to the bloc
addEventSync<Tb extends BlocEvent>(Tb event) → T
Send a synchronous event to the bloc
dispose() → void
Close the stream
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