ReactiveModelImp<T> class
- Inheritance
-
- Object
- ReactiveModel<
T> - ReactiveModelImp
- Implementers
- Available extensions
Constructors
-
ReactiveModelImp({required Object? creator(), required T? initialState, required bool autoDisposeWhenNotUsed, required StateInterceptor<
T> ? stateInterceptorGlobal})
Properties
- autoDisposeWhenNotUsed → bool
-
final
- completer ↔ Completer?
-
getter/setter pair
- connectionState → ConnectionState
-
no setterinherited
- creator → Object? Function()
-
final
- customStatus ↔ Object?
-
Custom status of the state. Set manually to mark the state with a particular
tag to be used in your logic.
getter/setter pairinherited
- error → dynamic
-
The error
no setterinherited
- hasData → bool
-
The state is mutated successfully.
no setteroverride
- hasError → bool
-
The stats has error
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasObservers → bool
-
Whether the state has listeners or not
no setterinherited
-
initialSnapState
→ SnapState<
T> -
no setter
- initialState ↔ T?
-
getter/setter pair
- isDone → bool
-
The state is mutated using a stream and the stream is done.
no setteroverride
- isIdle → bool
-
The state is initialized and never mutated.
no setteroverride
- isInitialized ↔ bool
-
getter/setter pair
- isStateInitialized → bool
-
no setteroverride
- isWaiting → bool
-
The state is waiting for and asynchronous task to end.
no setteroverride
- isWaitingToInitialize ↔ bool
-
getter/setter pair
- mockableCreator → Object? Function()
-
no setter
- observerLength → int
-
no setter
-
oldSnapState
→ SnapState<
T> ? -
no setter
-
rebuild
→ _Rebuild<
T> -
Available on ReactiveModel<
listen to the stateT> , provided by the ReactiveModeX extensionno setter - removeFromReactiveModel ↔ VoidCallback?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
snapState
→ SnapState<
T> -
A snap representation of the state
no setteroverride
-
snapValue
↔ SnapState<
T> -
getter/setter pair
- state ↔ T
-
The current state
getter/setter pairoverride
-
stateAsync
↔ Future<
T> -
The current Async state
getter/setter pairoverride
-
stateInterceptorGlobal
→ StateInterceptor<
T> ? -
final
- subscription ↔ StreamSubscription?
-
It is not null if the state is waiting for a Future or is subscribed to a
Stream
getter/setter pairinherited
Methods
-
addCleaner(
VoidCallback listener) → VoidCallback -
Add a callback to be executed when the state is disposed of.
inherited
-
addObserver(
{required ObserveReactiveModel listener, bool shouldAutoClean = false, bool isSideEffects = true}) → VoidCallback -
Add observer to this state.
inherited
-
cleanState(
) → void -
Clean the state
inherited
-
dispose(
) → void -
Dispose the state
override
-
disposeIfNotUsed(
) → void -
Dispose the state if it has no listener
override
-
initialize(
) → void -
initializeState(
) → FutureOr< T?> -
Initialize the state
inherited
-
interceptState(
SnapState< T> snap, StateInterceptor<T> ? stateInterceptor) → SnapState<T> ? -
middleSetCreator(
StateStatus status, Object? result) → void -
middleSetState(
StateStatus status, Object? result, {SideEffects< T> ? sideEffects, StateInterceptor<T> ? stateInterceptor, bool shouldOverrideDefaultSideEffects(SnapState<T> )?}) → dynamic -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
{SnapState< T> ? nextSnap, SideEffects<T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → bool -
Notify observers
override
-
onAll<
R> ({R onIdle()?, required R onWaiting()?, required R onError(dynamic error, VoidCallback refreshError)?, required R onData(T data)}) → R -
Listen to the injected Model and rebuild when it emits a notification.
inherited
-
onOrElse<
R> ({R onIdle()?, R onWaiting()?, R onError(dynamic error, VoidCallback refreshError)?, R onData(T data)?, required R orElse(T data)}) → R -
Listen to the injected Model and rebuild when it emits a notification.
inherited
-
onStateInitialized(
) → void -
rebuildState(
) → void -
refresh(
) → Future< T?> -
Refresh the Injected state. Refreshing the state means reinitialize
it and reinvoke its creation function and notify its listeners.
override
-
resetDefaultState(
) → void -
setState(
Object? mutator(T s), {SideEffects< T> ? sideEffects, StateInterceptor<T> ? stateInterceptor, bool shouldOverrideDefaultSideEffects(SnapState<T> snap)?, int debounceDelay = 0, int throttleDelay = 0}) → Future<T?> -
Mutate the state of the model and notify observers.
override
-
setStateNullable(
Object? mutator(T? s), {required void middleSetState(StateStatus, dynamic result), required StackTrace? stackTrace}) → FutureOr< T?> -
setToHasData(
dynamic data, {SideEffects< T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → void -
Set the state to the data status
override
-
setToHasError(
dynamic error, {StackTrace? stackTrace, VoidCallback? refresher, SideEffects< T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → void -
Set the state to the error status
override
-
setToIsIdle(
[Object? data]) → void -
Set the state to the idle status
override
-
setToIsWaiting(
{SideEffects< T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → void -
Set the state to the waiting status
override
-
toggle(
) → void -
Available on ReactiveModel<
Toggle the state and notify listenersbool> , provided by the ReactiveModelBool extension -
toString(
) → String -
A string representation of this object.
override
-
whenConnectionState<
R> ({R onIdle()?, required R onWaiting()?, required R onError(dynamic error)?, required R onData(T data)}) → R -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited