Skip to content

Commit 93f83fb

Browse files
committed
Doc improvements.
1 parent 0b80803 commit 93f83fb

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Sponsored by [MyText.ai](https://mytext.ai)
88

99
[![](./example/SponsoredByMyTextAi.png)](https://mytext.ai)
1010

11-
## 25.6.0
11+
## 25.6.1
1212

1313
* You can now use the selector extension `context.select((state) => ...)` to
1414
select only the part of the state you need in your widget, so that your widget

README.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ Or use `context.select()` to select only the parts of the state you need.
103103

104104
```dart
105105
Widget build(context) {
106-
var state = context.select((st) =>
107-
(name: st.user.name, age: st.user.age),
106+
var state = context.select((st) => (
107+
name: st.user.name,
108+
age: st.user.age),
108109
);
109110
110111
return Text('${state.name} has ${state.age} years old');
@@ -126,24 +127,9 @@ Widget build(context) {
126127

127128
# Actions and reducers
128129

129-
An **action** is a class that contain its own **reducer**.
130+
The application state is **immutable**.
130131

131-
```dart
132-
class Increment extends Action {
133-
134-
// The reducer has access to the current state
135-
int reduce() => state + 1; // It returns a new state
136-
}
137-
```
138-
139-
 
140-
141-
# Dispatch an action
142-
143-
The store state is **immutable**.
144-
145-
The only way to change the store **state** is by dispatching an **action**.
146-
The action reducer returns a new state, that replaces the old one.
132+
The only way to change the **state** is by dispatching an **action**.
147133

148134
```dart
149135
// Dispatch an action
@@ -161,6 +147,17 @@ await store.dispatchAndWaitAll([Increment(), LoadText()]);
161147

162148
 
163149

150+
An **action** is a class that contain its own **reducer**.
151+
The action reducer returns a new state, that replaces the old one.
152+
153+
```dart
154+
class Increment extends Action {
155+
156+
// The reducer has access to the current state
157+
int reduce() => state + 1; // It returns a new state
158+
}
159+
```
160+
164161
# Widgets can dispatch actions
165162

166163
In your widgets, use `context.dispatch` , `context.dispatchAll` etc.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: async_redux
22
description: The modern version of Redux. State management that's simple to learn and easy to use; Powerful enough to handle complex applications with millions of users; Testable.
3-
version: 25.6.0
3+
version: 25.6.1
44
# author: Marcelo Glasberg <[email protected]>
55
homepage: https://github.com/marcglasberg/async_redux
66
topics:

0 commit comments

Comments
 (0)