Skip to content

Commit 0dc2499

Browse files
authored
Merge pull request #21 from davidmarne/0.4.5
0.4.5
2 parents 0663b0e + 5daff99 commit 0dc2499

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.5
2+
3+
* create explicit typedefs for funcs passed to StoreConnection, as the new Function syntax messes up the analyzer
4+
15
## 0.4.4
26

37
* add StoreConnection, which is an implementation of store connector that takes a connect & builder function as parameters.

lib/flutter_built_redux.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import 'package:meta/meta.dart';
44
import 'package:flutter/widgets.dart' hide Builder;
55
import 'package:built_redux/built_redux.dart';
66

7+
/// [Connect] maps state from the store to the local state that a give
8+
/// component cares about
9+
typedef LocalState Connect<StoreState, LocalState>(StoreState state);
10+
11+
/// [WidgetBuilder] returns a widget given context, local state, and actions
12+
typedef Widget WidgetBuilder<LocalState, Actions extends ReduxActions>(
13+
BuildContext context, LocalState state, Actions actions);
14+
715
/// [StoreConnection] is a widget that rebuilds when the redux store
816
/// has triggered and the connect function yields a new result. It is an implementation
917
/// of `StoreConnector` that takes a connect function and builder function as parameters
@@ -24,9 +32,8 @@ import 'package:built_redux/built_redux.dart';
2432
/// [LocalState] should be comparable. It is recommended to only use primitive or built types.
2533
class StoreConnection<StoreState, Actions extends ReduxActions, LocalState>
2634
extends StoreConnector<StoreState, Actions, LocalState> {
27-
final LocalState Function(StoreState state) _connect;
28-
final Widget Function(BuildContext context, LocalState state, Actions actions)
29-
_builder;
35+
final Connect<StoreState, LocalState> _connect;
36+
final WidgetBuilder<LocalState, Actions> _builder;
3037

3138
StoreConnection({
3239
@required LocalState connect(StoreState state),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Important: Use "flutter packages get", not "pub get".
22
name: flutter_built_redux
33
author: David Marne <davemarne@gmail.com>
4-
version: 0.4.4
4+
version: 0.4.5
55
description: Built_redux provider for Flutter
66
homepage: https://github.com/davidmarne/flutter_built_redux
77
dependencies:

0 commit comments

Comments
 (0)