BitControl<M, V, L> class
Constructors
-
BitControl(Bit<V, L> _bit, {M map(V value, M? previous)?, M? initial, bool lazy = true, bool history = true})
-
-
BitControl.worker(BitWorker<V, L> worker, {M? initial, bool lazy = true, bool history = true})
-
Methods
-
act(FutureOr<M> onData(M data), {bool silent = true})
→ void
-
this method allows you to easily mutate the state of the bit
it is a shorthand for the
state.whenOrNull
method.
It will call the onData
function
and emit the result of the function if it does not throw an error
otherwise it will emit an error state.
-
back()
→ void
-
Emits the previous state, if
history
is enabled.
otherwise, it does nothing.
-
backIsPossible()
→ bool
-
Returns true if the history is not empty.
This means that the back method will have an effect.
-
dispose()
→ void
-
-
effect(BitState<M, L> state)
→ void
-
Gets called whenever the state of the bit changes.
-
emit(M data)
→ void
-
-
emitError(dynamic e)
→ void
-
-
emitLoading([L? loading])
→ void
-
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
onStateChange()
→ void
-
-
reload({bool silent = false})
→ void
-
-
toString()
→ String
-
A string representation of this object.
inherited