Bloc<S> class abstract

The central class behind this library

It is responsible for processing all the events and broadcasting corresponding changes made to the state. R is the type which subclasses Bloc S is the type of value which this bloc broadcasts. S must implement equality

Implementers

Constructors

Bloc({S? initialState, BlocMonitor monitor = const BlocEventsPrinter()})
initialState is the state which is set at initialization. if its null, the initial state is set to busy.

Properties

error StateError
no setter
hasError bool
no setter
hashCode int
The hash code for this object.
no setterinherited
isBusy bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → S
no setter
stream Stream<S?>
Broadcast Stream to which all builders listen
no setter

Methods

dispose() Future<void>
Send a done event and disposes the stream
nextState(S? currentState, S update) → S?
Called to calculate the new state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → void
Broadcasts the same state
setBusy({String? event}) → void
Called by blocs (subclasses) when the updated state isn't available immediately
setError(StateError error, {String? event}) → void
Called by blocs (subclasses) when an error occurs
setState(S update, {String? event}) → void
Called by blocs (subclasses) when the state is updated
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

checkIfValueType bool
getter/setter pair