A notifier where the state is updated by dispatching actions.
You do not have access to Ref in this notifier, so you need to pass the required dependencies via constructor.
From outside, you should dispatch actions with
ref.redux(provider).dispatch(action)
.
Dispatching inside the notifier is discouraged because you
will lose the origin.
In edge cases, you can use this.redux.dispatch(action)
.
- Implementers
Constructors
Properties
- customDebugLabel → String?
-
Override this to provide a custom debug label.
no setterinherited
- debugLabel → String
-
A label to be used in debug messages and
by the
RefenaTracingPage
.no setterinherited -
dependencies
→ Set<
BaseNotifier> -
A collection of notifiers that this notifier depends on.
finalinherited
-
dependents
→ Set<
BaseNotifier> -
A collection of notifiers that depend on this notifier.
They will be disposed when this notifier is disposed.
finalinherited
-
disposeAction
→ SynchronousReduxAction<
ReduxNotifier< ?T> , T, dynamic> -
no setter
- disposed → bool
-
Whether this notifier is disposed.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialAction
→ BaseReduxAction<
ReduxNotifier< ?T> , T, dynamic> -
Override this to provide a custom action that will be
dispatched when the notifier is initialized.
no setter
-
provider
→ BaseProvider<
BaseNotifier< ?T> , T> -
The provider that created this notifier.
This is only available after the initialization.
no setterinherited
-
redux
→ Dispatcher<
ReduxNotifier< T> , T> -
Access the Dispatcher of this notifier.
latefinal
- requireBuildContext → bool
-
If this is true, initializing must be done by ViewModelBuilder of the refena_flutter package.
This flag is needed to throw an exception if the user forgets to use ViewModelBuilder.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state ↔ T
-
Gets the current state.
getter/setter pairinherited-getter
Methods
-
addListener(
Rebuildable rebuildable, ListenerConfig< T> config) → void -
inherited
-
cleanupListeners(
) → void -
inherited
-
describeState(
T state) → String -
Override this to provide a customized description of the state.
This is used by the built-in observers for improved logging.
inherited
-
dispatch(
SynchronousReduxAction< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → TT> , T, dynamic> - Dispatches an action and updates the state. Returns the new state.
-
dispatchAsync(
AsynchronousReduxAction< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → Future<T> , T, dynamic>T> - Dispatches an asynchronous action and updates the state. Returns the new state.
-
dispatchAsyncTakeResult<
R> (BaseAsyncReduxActionWithResult< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → Future<T> , T, R>R> - Dispatches an asynchronous action and updates the state. Returns only the result of the action.
-
dispatchAsyncWithResult<
R> (BaseAsyncReduxActionWithResult< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → Future<T> , T, R>(T, R)> - Dispatches an asynchronous action and updates the state. Returns the new state along with the result of the action.
-
dispatchTakeResult<
R> (BaseReduxActionWithResult< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → RT> , T, R> - Dispatches an action and updates the state. Returns only the result of the action.
-
dispatchWithResult<
R> (BaseReduxActionWithResult< ReduxNotifier< action, {String? debugOrigin, LabeledReference? debugOriginRef}) → (T, R)T> , T, R> - Dispatches an action and updates the state. Returns the new state along with the result of the action.
-
dispose(
) → void - This is called on Ref.dispose. You can override this method to dispose resources.
-
external<
T2> (ReduxNotifier< T2> notifier) → Dispatcher<ReduxNotifier< T2> , T2> - Creates a Dispatcher for an external notifier.
-
getListeners(
) → List< Rebuildable> -
inherited
-
getStream(
) → Stream< NotifierEvent< T> > -
inherited
-
init(
) → T - Initializes the state of the notifier. This method is called only once and as soon as the notifier is accessed the first time.
-
internalSetup(
ProxyRef ref, BaseProvider< BaseNotifier< ? provider) → voidT> , T> - Handles the actual initialization of the notifier. Calls init internally.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
postInit(
) → void - Override this to provide a custom post initialization. The initial state is already set at this point.
-
registerWatchAction(
WatchActionSubscription subscription) → void - Registers a WatchAction so it can be later disposed when the notifier is disposed.
-
removeListener(
Rebuildable rebuildable) → void -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateShouldNotify(
T prev, T next) → bool -
Override this if you want to a different kind of equality.
inherited
Operators
-
operator ==(
Object other) → bool -
Subclasses should not override this method.
It is used internally by dependencies and dependents.
inherited
Static Methods
-
test<
T, E extends Object> ({required ReduxNotifier< T> redux, bool runInitialAction = false, T? initialState}) → ReduxNotifierTester<T> -
Returns a debug version of the
notifier
where you can set the state directly and dispatch actions