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})

Properties

hashCode int
The hash code for this object.
no setterinherited
map → M Function(V value, M? previous)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state BitState<M, L>
getter/setter pair
stream Stream<BitState<M, L>>
no setter

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

Operators

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

Static Methods

maybeOf<B extends BitControl>(BuildContext context) → B?
of<B extends BitControl>(BuildContext context) → B