ReactiveModel<T> class Null safety

A lightweight version of InjectedImp

Implementers
Available Extensions

Constructors

ReactiveModel()
ReactiveModel.create(T state, {bool autoDisposeWhenNotUsed = true})
factory
ReactiveModel.future(Future<T> creator(), {T? initialState, bool autoDisposeWhenNotUsed = true})
factory
ReactiveModel.stream(Stream<T> creator(), {T? initialState, bool autoDisposeWhenNotUsed = true})
factory

Properties

autoDisposeWhenNotUsed bool
read-only, inherited
connectionState ConnectionState
read-only
customStatus Object?
Custom status of the state. Set manually to mark the state with a particular tag to be used in your logic.
read / write, inherited
debugMessage String?
read / write, inherited
error → dynamic
The error
read-only, inherited
hasData bool
The state is mutated successfully.
read-only, inherited
hasError bool
The stats has error
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
hasObservers bool
Whether the state has observers
read-only, inherited
isActive bool
Whether the state is active or not. [...]
read-only, inherited
isDone bool
The state is mutated using a stream and the stream is done.
read-only, inherited
isIdle bool
The state is initialized and never mutated.
read-only, inherited
isWaiting bool
The state is waiting for and asynchronous task to end.
read-only, inherited
observerLength int
read-only
oldSnapState SnapState<T>
read-only, inherited
rebuild → _Rebuild<T>
Callable class used to listen to a reactive (injected) model and rebuild widget [...]
late, final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
snapState SnapState<T>
A snap representation of the state
read / write, inherited
state ↔ T
read / write, inherited
stateAsync Future<T>
It is a future of the state. The future is active if the state is on the isWaiting status.
read-only, inherited
subscription StreamSubscription?
It is not null if the state is waiting for a Future or is subscribed to a Stream
read-only, inherited

Methods

catchError(void onError(dynamic error, StackTrace s)) Future<InjectedBase<T>>
inherited
dispose() → void
Dispose the state.
inherited
initializeState() FutureOr<T>
Initialize the state
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notify() → void
Notify observers
inherited
onAll<R>({R onIdle()?, required R onWaiting()?, required R onError(dynamic error, VoidCallback refreshError)?, required R onData(T data)}) → R
inherited
onErrorRefresher() → void
IF the state is in the hasError status, The last callback that causes the error can be reinvoked.
inherited
onOrElse<R>({R onIdle()?, R onWaiting()?, R onError(dynamic error, VoidCallback refreshError)?, R onData(T data)?, required R orElse(T data)}) → R
inherited
refresh() Future<T?>
Refresh the Injected state. Refreshing the state means reinitialize it and reinvoke its creation function and notify its listeners. [...]
inherited
setState<R>(FutureOr<R> fn(T s), {void onData(T data)?, void onError(dynamic error)?, On<void>? onSetState, void onRebuildState()?, SideEffects<T>? sideEffects, int debounceDelay = 0, int throttleDelay = 0, bool shouldAwait = false, bool skipWaiting = false, BuildContext? context, bool shouldOverrideDefaultSideEffects(SnapState<T> snap)?}) Future<T>
Mutate the state of the model and notify observers. [...]
inherited
subscribeToRM(void fn(SnapState<T>? snap)) VoidCallback
Subscribe to the state
inherited
toggle() → void
If the state is bool, toggle it and notify listeners [...]
inherited
toString() String
A string representation of this object. [...]
inherited
whenConnectionState<R>({required R onIdle(), required R onWaiting(), required R onData(T snapState), required R onError(dynamic error), bool catchError = true}) → R
Exhaustively switch over all the possible statuses of connectionState. Used mostly to return Widgets.

Operators

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