📄️ State
The application state is all the data that your app needs to function,
📄️ Store
Declare your store by instantiating the Store class and using AppState as the type parameter:
📄️ Using the store state
To access the store state inside of widgets, you could use the
📄️ Actions and reducers
As discussed, the AppState class that represents the state is immutable.
📄️ Sync actions
If you want to modify the state synchronously,
📄️ Async actions
If you want to do some asynchronous work, simply declare the action reducer to
📄️ Changing state is optional
For both sync and async reducers, returning a new state is optional. If you don't plan on changing
📄️ Action simplification
As discussed, all your actions are classes that extend the abstract base
📄️ Dispatching actions
As discussed, the only way to change the store state is by dispatching actions.
📄️ Failed actions
Actions that fail can simply throw errors using throw SomeError().
📄️ Wait, fail, succeed
A common pattern involves having a process that can either succeed or fail.