bloc library

Classes

Bloc<Event extends Object?, State extends Object?>
Takes a Stream of Events as input and transforms them into a Stream of States as output.
Change<State>
A Change represents the change from one State to another. A Change consists of the currentState and nextState.
IBloc<Event extends Object?, State extends Object?>
An interface to implement the Publisher/Subscriber pattern for Bloc. Takes a Stream of Events as input and transforms them into a Stream of States as output.
IBlocObserver
An interface for observing the behavior of Bloc instances.
IBlocSink<Event extends Object?>
A Bloc Sink interface that accepts events both synchronously and asynchronously.
IBlocSubject<State extends Object?>
Interface to observe states stream. Current state available as property. Bloc Subject to implement the Publisher/Subscriber pattern
IStateObservable<T extends Object?>
An interface to observe states stream. Current state available as property. State subject to implement the Observer (Dependents) pattern
StateStream<State extends Object?>
Broadcast State stream view for BLoC pattern.
Transition<Event, State>
A Transition is the change from one state to another. Consists of the currentState, an event, and the nextState.

Typedefs

TransitionFunction<Event, State> = Stream<Transition<Event, State>> Function(Event event)
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.