bloc library Null safety
A predictable state management library for Dart.
Get started at bloclibrary.dev 🚀
Classes
-
Bloc<
Event, State> -
Takes a
Stream
ofEvents
as input and transforms them into aStream
ofStates
as output. -
BlocBase<
State> - An interface for the core functionality implemented by both Bloc and Cubit.
- BlocObserver
- An interface for observing the behavior of Bloc instances.
-
Change<
State> -
A Change represents the change from one
State
to another. A Change consists of the currentState and nextState. -
Cubit<
State> - A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states. [...]
-
Emitter<
State> - Base interface for emitting states in response to events.
-
Transition<
Event, State> - A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.
Typedefs
-
EventHandler<
Event, State> (Event event, Emitter< State> emit) → FutureOr<void> -
An event handler is responsible for reacting to an incoming
Event
and can emit zero or more states via the Emitter. -
EventMapper<
Event> (Event event) → Stream< Event> - Signature for a function which converts an incoming event into an outbound stream of events. Used when defining custom EventTransformers.
-
EventTransformer<
Event> (Stream< Event> events, EventMapper<Event> mapper) → Stream<Event> - Used to change how events are processed. By default events are processed concurrently.
-
TransitionFunction<
Event, State> (Event) → Stream< Transition< Event, State> > -
Signature for a mapper function which takes an
Event
as input and outputs a Stream of Transition objects.
Exceptions / Errors
- BlocUnhandledErrorException
- Exception thrown when an unhandled error occurs within a bloc. [...]