InjectedImp<T> class
- Inheritance
-
- Object
- ReactiveModel<
T> - ReactiveModelImp<
T> - InjectedImp
- Implemented types
-
- Injected<
T>
- Injected<
- Implementers
- Available extensions
Constructors
-
InjectedImp({required Object? creator(), required T? initialState, required SideEffects<
T> ? sideEffectsGlobal, required StateInterceptor<T> ? stateInterceptor, required bool autoDisposeWhenNotUsed, required String? debugPrintWhenNotifiedPreMessageGlobal, required Object? toDebugString(T?)?, required DependsOn<T> ? dependsOn, required Object? watch(T? s)?})
Properties
- autoDisposeWhenNotUsed → bool
-
finalinherited
-
cachedCreatorMocks
↔ List<
dynamic Function()?> -
getter/setter pair
- canRedoState → bool
-
Whether the state can be redone.
no setteroverride
- canUndoState → bool
-
Whether the state can be done
no setteroverride
- completer ↔ Completer?
-
getter/setter pairinherited
- connectionState → ConnectionState
-
no setterinherited
- creator → Object? Function()
-
finalinherited
- creatorUpdatable ↔ Object? Function()
-
getter/setter pair
- 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
- debugPrintWhenNotifiedPreMessageGlobal → String?
-
final
-
dependsOn
→ DependsOn<
T> ? -
final
- error → dynamic
-
The error
no setterinherited
- hasData → bool
-
The state is mutated successfully.
no setterinherited
- hasError → bool
-
The stats has error
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasObservers → bool
-
Whether the state has listeners or not
no setterinherited
-
inheritedInjects
→ Set<
InjectedImp< T> > -
final
-
initialSnapState
→ SnapState<
T> -
no setteroverride
- initialState ↔ T?
-
getter/setter pairinherited
- isDone → bool
-
The state is mutated using a stream and the stream is done.
no setterinherited
- isIdle → bool
-
The state is initialized and never mutated.
no setterinherited
- isInitialized ↔ bool
-
getter/setter pairinherited
- isStateInitialized → bool
-
no setterinherited
- isWaiting → bool
-
The state is waiting for and asynchronous task to end.
no setterinherited
- isWaitingToInitialize ↔ bool
-
getter/setter pairinherited
- mockableCreator → Object? Function()
-
no setteroverride
- observerLength → int
-
no setterinherited
-
oldSnapState
→ SnapState<
T> ? -
no setterinherited
- removeFromReactiveModel ↔ VoidCallback?
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sideEffectsGlobal
→ SideEffects<
T> ? -
final
-
snapState
→ SnapState<
T> -
A snap representation of the state
no setterinherited
-
snapValue
↔ SnapState<
T> -
getter/setter pairinherited
- state ↔ T
-
The current state
getter/setter pairinherited
-
stateAsync
↔ Future<
T> -
The current Async state
getter/setter pairinherited
-
stateInterceptorGlobal
→ StateInterceptor<
T> ? -
finalinherited
- subscription ↔ StreamSubscription?
-
It is not null if the state is waiting for a Future or is subscribed to a
Stream
getter/setter pairinherited
- toDebugString → Object? Function(T?)?
-
final
- watch → Object? Function(T? s)?
-
final
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
-
call(
BuildContext context, {bool defaultToGlobal = false}) → Injected< T> -
Obtain the Injected model from the nearest InheritedWidget inserted using inherited.
override
-
cleanState(
) → void -
Clean the state
inherited
-
clearUndoStack(
) → void -
Clear undoStack;
override
-
deletePersistState(
) → void -
Delete the state form the persistence store
override
-
dispose(
) → void -
Dispose the state
override
-
disposeIfNotUsed(
) → void -
Dispose the state if it has no listener
inherited
-
inherited(
{required Widget builder(BuildContext), Key? key, required FutureOr< T> stateOverride()?, bool? connectWithGlobal, SideEffects<T> ? sideEffects, String? debugPrintWhenNotifiedPreMessage, Object? toDebugString(T?)?}) → Widget -
Provide the injected model using an InheritedWidget that wraps its state.
override
-
initialize(
) → void -
inherited
-
initializeState(
) → FutureOr< T?> -
Initialize the state
inherited
-
injectFutureMock(
Future< T> fakeCreator()) → void -
Inject a fake future implementation of this injected model.
override
-
injectMock(
T fakeCreator()) → void -
Inject a fake implementation of this injected model.
override
-
injectStreamMock(
Stream< T> fakeCreator()) → void -
Inject a fake stream implementation of this injected model.
override
-
interceptState(
SnapState< T> snap, StateInterceptor<T> ? stateInterceptor) → SnapState<T> ? -
inherited
-
middleSetCreator(
StateStatus status, Object? result) → void -
inherited
-
middleSetState(
StateStatus status, Object? result, {SideEffects< T> ? sideEffects, StateInterceptor<T> ? stateInterceptor, bool shouldOverrideDefaultSideEffects(SnapState<T> )?}) → dynamic -
inherited
-
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
-
of(
BuildContext context, {bool defaultToGlobal = false}) → T -
Obtain the state from the nearest InheritedWidget inserted using inherited.
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 -
override
-
persistState(
) → void -
Persist the state
override
-
rebuildState(
) → void -
override
-
redoState(
) → void -
Redo to the next valid state (isWaiting and hasError are ignored)
override
-
refresh(
{String? infoMessage}) → Future< T?> -
Refresh the Injected state. Refreshing the state means reinitialize
it and reinvoke its creation function and notify its listeners.
override
-
reInherited(
{Key? key, required BuildContext context, required Widget builder(BuildContext context)}) → Widget -
Provide the Injected model to another widget tree branch.
override
-
resetDefaultState(
[VoidCallback? fn]) → void -
override
-
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.
inherited
-
setStateNullable(
Object? mutator(T? s), {required void middleSetState(StateStatus, dynamic result), required StackTrace? stackTrace}) → FutureOr< T?> -
inherited
-
setToHasData(
dynamic data, {SideEffects< T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → void -
Set the state to the data status
inherited
-
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
inherited
-
setToIsIdle(
[Object? data]) → void -
Set the state to the idle status
inherited
-
setToIsWaiting(
{SideEffects< T> ? sideEffects, bool shouldOverrideDefaultSideEffects(SnapState<T> )?, StateInterceptor<T> ? stateInterceptor}) → void -
Set the state to the waiting status
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
undoState(
) → void -
Undo to the last valid state (isWaiting and hasError are ignored)
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