BlocStateController<S extends BlocState> class
An interface that equips a BlocController
with a built-in state.
This state must be a class that inherits from BlocState
.
- Inheritance
- Object
- BlocController
- BlocStateController
Constructors
- BlocStateController()
- Initializes the controller, using the initialState getter as the initial state.
- BlocStateController.withState(BlocState state)
- Initializes the controller with a state. If the state argument is null, the value of initialState is used.
Properties
- initialState → S
-
If an implementing class overrides this getter, the controller will
be initialized with the returned object as the initial state.
@required, read-only
- state → S
-
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
-
sink
→ StreamSink<
BlocController> -
read-only, inherited
-
stream
→ Observable<
BlocController> -
read-only, inherited
Methods
-
onStateDone(
) → void -
Method that is called when the state's stream closes. Does nothing by default.
@protected
-
onStateError(
Object error, StackTrace stackTrace) → void -
Method that is called when the state's stream reports an error. Prints the error message by default.
@protected
-
onStateMutate(
S data) → void -
Method that is called when the state object signals a mutation. Notifies this
controller's stream of the change.
@mustCallSuper, @protected
-
registerState(
S state) → void - Sets the underlying state object and registers this object's state listeners to be notified of updates to the state's stream.
-
dispose(
) → void -
Closes the underlying stream. Inheriting classes that overload this method must call
super.dispose()
.@mustCallSuper, inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
onError(
Object error, StackTrace stackTrace) → void -
Method that is called when the stream reports an error. Prints the error message by default.
@protected, inherited
-
postUpdatePublished(
) → void -
Method that is called when publishUpdate is called, after the stream is notified. Does nothing by default.
@protected, inherited
-
preUpdatePublished(
) → void -
Method that is called when publishUpdate is called but before the stream is notified. Does nothing by default.
@protected, inherited
-
publishUpdate(
) → Future< void> -
Notifies the underlying stream of an update. Passes a reference to this object to the stream.
inherited
-
subscribeToUpdates(
void onUpdate(BlocController), { void onError(Error, StackTrace), void onDone() }) → StreamSubscription -
Registers the given callback methods with the underlying stream and returns
the resulting
StreamSubscription
.inherited -
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited