BlocBuilder<T> class

Builds Blocs. You should use this instead of constructing a Bloc directly Use addHandler to handle async events and addSyncHandler to handle synchronous events

Annotations

Constructors

BlocBuilder(T initialState(Object? arguments))
Creates a BlocBuilder with an initial state

Properties

hashCode int
The hash code for this object.
no setterinherited
initialState → T Function(Object? arguments)
The state of the Bloc upon initialization
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addHandler<TEvent extends BlocEvent>(Future<T> handler(T getState(), TEvent event, void updateState(T), Object? pageScope)) → void
Add an async Bloc event handler. getState gets the current Bloc state. Because this function is async, the the state may change between async calls. The event is the event that was sent to the Bloc. updateState is a function that updates the Bloc state. Call this to set state on things like progress indicators in a long running process. pageScope is an optional object that can be used for the lifetime of the page.
addSyncHandler<TEvent extends BlocEvent>(T handler(T state, TEvent event)) → void
Add a sync event handler.
build({Object? arguments, Object? pageScope}) Bloc<T>
Build the Bloc
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