async_redux library

Classes

ActionObserver<St>
ActionStatus
BaseModel<St>
Don't use, this is deprecated. Please, use the recommended Vm class. This should only be used for IMMUTABLE classes. Lets you implement equals/hashcode without having to override these methods.
DefaultModelObserver<Model>
This model observer prints the StoreConnector's ViewModel to the console. [...]
DevelopmentErrorObserver<St>
During development, use this error observer if you want all errors to be shown to the user in a dialog, not only UserExceptions. In more detail: This will wrap all errors into UserExceptions, and put them all into the error queue. Note that errors which are NOT originally UserExceptions will still be thrown, while UserExceptions will still be swallowed. [...]
ErrorObserver<St>
This will be given all errors, including those of type UserException. Return true to throw the error. False to swallow it. [...]
Event<T>
The Event class can be used as a Redux state with flutter_redux , usually to change the internal state of a stateful widget. When creating the ViewModel with the StoreConnector, the event is "consumed" only once, and is then automatically considered "spent". [...]
EventMultiple<T>
An Event from multiple sub-events. When consuming this event, if the first sub-event is not spent, it will be consumed, and the second will not. If the first sub-event is spent, the second one will be consumed. [...]
ExceptionCode
Log<St>
Connects a Logger to the Redux Store. Every action that is dispatched will be logged to the Logger, along with the new State that was created as a result of the action reaching your Store's reducer. [...]
MappedEvent<V, T>
A MappedEvent is useful when your event value must be transformed by some function that, usually, needs the store state. You must provide the event and a map-function. The map-function must be able to deal with the spent state (null or false, accordingly). [...]
MockAction<St>
MockStore<St>
Creates a Redux store that lets you mock actions/reducers. [...]
ModelObserver<Model>
This will be given all errors, including those of type UserException. Return true to throw the error. False to swallow it. Note: [...]
Available constructors: NavigateAction.push(), NavigateAction.pop(), NavigateAction.popAndPushNamed(), NavigateAction.pushNamed(), NavigateAction.pushReplacement(), NavigateAction.pushAndRemoveUntil(), NavigateAction.replace(), NavigateAction.replaceRouteBelow(), NavigateAction.pushReplacementNamed(), NavigateAction.pushNamedAndRemoveUntil(), NavigateAction.pushNamedAndRemoveAll(), NavigateAction.popUntil(), NavigateAction.removeRoute(), NavigateAction.removeRouteBelow(), NavigateAction.popUntilRouteName(), NavigateAction.popUntilRoute(),
PersistAction<St>
Persistor<St>
Use it like this: [...]
PersistorDummy<T>
A dummy persistor.
PersistorPrinterDecorator<T>
A decorator to print persistor information to the console. Use it like this: [...]
ReduxAction<St>
Actions must extend this class. [...]
StateObserver<St>
Store<St>
Creates a Redux store that holds the app state. [...]
StoreConnector<St, Model>
Build a widget based on the state of the Store. [...]
StoreConnectorInterface<St, Model>
StoreProvider<St>
Provides a Redux Store to all ancestors of this Widget. This should generally be a root widget in your App. Connect to the Store provided by this Widget using a StoreConnector.
StoreTester<St>
Helps testing the store, actions, and sync/async reducers. [...]
SwallowErrorObserver<St>
Swallows all errors (not recommended). Passe it to the store like this: [...]
TestErrorObserver<St>
During tests, use this error observer if you want all errors to be thrown, and not swallowed, including UserExceptions. You should probably use this in all tests that you don't expect to throw any errors, including UserExceptions. [...]
TestInfo<St>
TestInfoList<St>
List of test information, before or after some actions are dispatched.
UserExceptionAction<St>
If you want the UserExceptionDialog to display some UserException, you must throw the exception from inside an action's before or reduce methods. [...]
UserExceptionDialog<St>
Use it like this: [...]
Vm
Vm is a base class for your view-models. [...]
VmEquals<T>
VmFactory<St, T>
Factory that creates a view-model of type Vm, for the StoreConnector: [...]
Wait
Immutable object to keep track of boolean flags that indicate if some process is in progress (the user is "waiting"). [...]
WaitAction<St>
For this to work your store state must have a Wait field named wait, and then: [...]
WrapError<St>
This will be given all errors (including of type UserException). [...]

Functions

cache1<R, S1>(R Function() f(S1)) → R Function() Function(S1)
Example: [...]
cache1_1<R, S1, P1>(R Function(P1) f(S1)) → R Function(P1) Function(S1)
Example: [...]
cache1_2<R, S1, P1, P2>(R Function(P1, P2) f(S1)) → R Function(P1, P2) Function(S1)
Example: [...]
cache2<R, S1, S2>(R Function() f(S1, S2)) → R Function() Function(S1, S2)
Example: [...]
cache2_1<R, S1, S2, P1>(R Function(P1) f(S1, S2)) → R Function(P1) Function(S1, S2)
Example: [...]
cache2_2<R, S1, S2, P1, P2>(R Function(P1, P2) f(S1, S2)) → R Function(P1, P2) Function(S1, S2)
Example: [...]
cache3<R, S1, S2, S3>(R Function() f(S1, S2, S3)) → R Function() Function(S1, S2, S3)
Example: [...]
internalsBaseModelInject<St>(BaseModel baseModel, St state, Store store) → void
For internal use only. Please don't use this.
internalsVmFactoryInject<St>(VmFactory vmFactory, St state, Store store) → void
For internal use only. Please don't use this.

Enums

WaitOperation

Typedefs

Dispatch<St>(ReduxAction<St> action, {bool notify}) → void
DispatchFuture<St>(ReduxAction<St> action, {bool notify}) Future<void>
MessageFormatter<St>(St state, ReduxAction<St> action, bool ini, int dispatchCount, DateTime timestamp) String
A function that formats the message that will be logged: [...]
OnDidChangeCallback<Model>(Model viewModel) → void
A function that will be run on State change, after the build method. [...]
OnDisposeCallback<St>(Store<St> store) → void
A function that will be run when the StoreConnector is removed from the Widget Tree. It is run in the State.dispose method. This can be useful for dispatching actions that remove stale data from your State tree.
OnInitCallback<St>(Store<St> store) → void
A function that will be run when the StoreConnector is initialized (using the State.initState method). This can be useful for dispatching actions that fetch data for your Widget when it is first displayed.
OnInitialBuildCallback<Model>(Model viewModel) → void
A function that will be run after the Widget is built the first time. This function is passed the initial Model created by the converter function. This can be useful for starting certain animations, such as showing Snackbars, after the Widget is built the first time.
OnWillChangeCallback<Model>(Model previousViewModel, Model newViewModel) → void
A function that will be run on state change, before the build method. This function is passed the Model, and if distinct is true, it will only be called if the Model changes. This is useful for making calls to other classes, such as a Navigator or TabController, in response to state changes. It can also be used to trigger an action based on the previous state.
Reducer<St>() FutureOr<St>
ShouldUpdateModel<St>(St state) bool
A test of whether or not your converter or vm function should run in response to a State change. For advanced use only. Some changes to the State of your application will mean your converter or vm function can't produce a useful Model. In these cases, such as when performing exit animations on data that has been removed from your Store, it can be best to ignore the State change while your animation completes. To ignore a change, provide a function that returns true or false. If the returned value is false, the change will be ignored. If you ignore a change, and the framework needs to rebuild the Widget, the builder function will be called with the latest Model produced by your converter or vm functions.
ShowUserExceptionDialog(BuildContext context, UserException userException) → void
StateCondition<St>(TestInfo<St> info) bool
Predicate used in StoreTester.waitCondition. Return true to stop waiting, and get the last state.
StoreConverter<St, Model>(Store<St> store) → Model
Convert the entire Store into a Model. The Model will be used to build a Widget using the ViewModelBuilder.
TestInfoPrinter(TestInfo) → void
ViewModelBuilder<Model>(BuildContext context, Model vm) Widget
Build a Widget using the BuildContext and Model. The Model is derived from the Store using a StoreConverter.
WaitReducer<St>(St state, WaitOperation operation, Object flag, Object ref) → St

Exceptions / Errors

PersistException
StoreConnectorError
StoreException
StoreExceptionTimeout
UserException
Represents an error the user could fix, like wrong typed text, or missing internet connection. Methods dialogTitle and dialogContent return Strings you can show in an error dialog. [...]