StateGraphBloc<Event, State> class abstract

Base class for Blocs using StateGraph, based on bloc package.

Constructors

StateGraphBloc(State initialState)
Creates a state graph bloc with a given initialState.

Properties

hashCode int
The hash code for this object.
no setterinherited
initialState → State
An initial state.
final
isClosed bool
no setter
lastState → State?
Last bloc state.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state Stream<State>
Current state stream.
no setter

Methods

add(Event event) → void
Adds an event to a queue.
bindState<N>(N convert(State currentState)) Stream<N>
Maps current state stream to the new one using convert method. Uses distinct operator to skip recurring values.
buildGraph() StateGraph<Event, State>
Method for building StateGraph instance.
close() → void
Closes bloc.
launchFuture<T>(Future<T> action, {void onData(T event)?, Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<T>
Launch action subscription that will be closed on Bloc's close method call. Converts action to Stream and returns Future which is exactly launchStream subscription.
launchStream<T>(Stream<T> action, {void onData(T event)?, Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<T>
Launch action subscription that will be cancelled on Bloc's close method call. Returns immediately cancelled StreamSubscription if bloc was already disposed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTransition(State previousState, Event event, State newState) → void
Method called on each state transition.
reset(State state) → void
Resets state machine to given state.
singleLiveEventSubject<T>() SingleLiveEventSubject<T>
Builds subject for SingleLiveEvents. Is auto-closed on close method.
toString() String
A string representation of this object.
inherited
transformEvents(Stream<Event> events) Stream<Event>
Transforms events.

Operators

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