StateController<S> class abstract

Every StateController has the following features:

  • Dispatching actions
  • Filtering actions
  • Adding effeccts
  • Communications among controllers
  • RxDart full features

Every StateController requires an initial state which will be the state of the StateController before emit has been called.

The current state of a StateController can be accessed via the state getter.

class CounterState extends StateController<int>{

   CounterState():super(0);

    void increment() => emit(state + 1);

    void decrement() => emit(state - 1);

}

Constructors

StateController(S initialState)

Properties

action$ Actions
Return a Acctions instance.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → S
Return the current state of the controller.
no setter
stream$ Stream<S>
Return the current state of the controller as a Stream<S>.
no setter

Methods

dispatch(Action action) → void
Dispatching an action is just like firing an event.
dispose() → void
This is a clean up funcction.
emit(S newState) → void
Sends a data newState.
importState(S newState) → void
Sends a data newState.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAction(Action action) → void
This function fired when action dispatches from the controllers.
onInit() → void
This function is fired after instantiating the controller.
registerEffects(Iterable<Stream<Action>> streams) → void
This function registers the effect/s and also un-registers previous effeccts (if found any).
remoteController<C extends StateController>() Stream<C>
This function returns Controller instance as a Steam based on the type you attached with the function.
remoteState<C extends StateController<S>, S>() Future<S>
This function returns the current state of a cubit as a Future value
remoteStream<C extends StateController<S>, S>() Stream<S>
This function returns the state of a the StateController instance as a Steam depends on the generic types you attached with the function.
select<T>(T mapCallback(S state)) Stream<T>
Return the part of the current state of the controller as a Stream<S>.
toString() String
A string representation of this object.
inherited

Operators

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