StateBloc<T> class

A class that holds a single state value accessible synchronously using StateBloc.value, as a Future using StateBloc.current or as a stream using StateBloc.stream and StateBloc.changes for a stream of the current and previous value.

Constructors

StateBloc([T? initialValue])

Properties

changes Stream<StateChangeTuple<T?>>
Returns a stream that emits all of changes to the value of the StateBloc as a StateChangeTuple containing the StateChangeTuple.current and StateChangeTuple.previous value.
no setter
current Future<T?>
A Future that waits for a value to be added to the StateBloc. Completes with the current value if the StateBloc already has a value.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Returns whether the StateBloc's stream controller is able to receive new events or has been closed.
no setter
next Future<T?>
A Future that waits for the next value to be added to the StateBloc.
no setter
nonNullStream Stream<T>
Returns a stream that emits all of the non-null updates to the value held by the StateBloc, starting with the current value.
no setter
previousValue → T?
The previous value of the StateBloc.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T?>
Returns a stream that emits all of the updates to the value held by the StateBloc, starting with the current value.
no setter
value ↔ T?
The current value of the StateBloc.
getter/setter pair

Methods

add(T? value) → void
Updates the current value of the StateBloc to the provided value.
close() → dynamic
Closes the StreamController for the StateBloc. No further items will be emitted by the StateBloc Stream or Future interfaces.
dispose() → dynamic
Disposes all resources held by the StateBloc.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setValue(void updateFn(T? currentValue)) → void
Executes the provided updateFn and then re-emits the updated value on the stream. Consider the following example where the current value is updated:
toString() String
A string representation of this object.
inherited

Operators

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