Skip to content

Commit 6a7ac42

Browse files
committed
add main to example
1 parent fc7d18c commit 6a7ac42

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

example/example.dart

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ import 'package:built_value/built_value.dart';
77

88
part 'example.g.dart';
99

10+
void main() {
11+
// create the store
12+
final store = new Store(
13+
reducerBuilder.build(),
14+
new Counter(),
15+
new CounterActions(),
16+
);
17+
18+
runApp(new ConnectionExample(store));
19+
// or comment the line above and uncomment the line below
20+
// runApp(new ConnectorExample(store));
21+
}
22+
1023
/// an example using `StoreConnection`
1124
class ConnectionExample extends StatelessWidget {
1225
final Store<Counter, CounterBuilder, CounterActions> store;
@@ -61,9 +74,7 @@ class CounterWidget extends StoreConnector<Counter, CounterActions, int> {
6174
CounterWidget();
6275

6376
@override
64-
int connect(Counter state) {
65-
return state.count;
66-
}
77+
int connect(Counter state) => state.count;
6778

6879
@override
6980
Widget build(BuildContext context, int count, CounterActions actions) =>
@@ -80,13 +91,7 @@ class CounterWidget extends StoreConnector<Counter, CounterActions, int> {
8091
);
8192
}
8293

83-
// Built redux counter store, actions, and reducer
84-
85-
Store<Counter, CounterBuilder, CounterActions> createStore() => new Store(
86-
reducerBuilder.build(),
87-
new Counter(),
88-
new CounterActions(),
89-
);
94+
// Built redux counter state, actions, and reducer
9095

9196
ReducerBuilder<Counter, CounterBuilder> reducerBuilder =
9297
new ReducerBuilder<Counter, CounterBuilder>()

0 commit comments

Comments
 (0)