Skip to content

Releases: davidmarne/flutter_built_redux

0.4.1

07 Jan 20:42
Compare
Choose a tag to compare
  • Add changelog

0.4.0

07 Jan 20:39
a03af25
Compare
Choose a tag to compare
  • Breaking changes:

    • Remove state builder generic from StoreConnector

    • Made StoreConnectorState private

  • Perform check on storeSub in didChangeDependencies to return early if a subscription to the store has already been created.

  • Raise exceptions if the store found by inheritFromWidgetOfExactType has different generics than the StoreConnector

  • Add unit tests

0.2.0

13 Oct 04:20
Compare
Choose a tag to compare

Rather than implementing StoreConnector & StoreConnectorState you now only have to have to write one object that implements connect & build. The build function also now takes the mapped state value and actions as parameters.

abstract class MyWidgetProps implements Built<MyWidgetProps, MyWidgetPropsBuilder> {
  String get propIWantFromMyReduxState;
  MyWidgetProps._();
  factory MyWidgetProps([updates(MyWidgetPropsBuilder b)]) => _$MyWidgetProps;
}

class MyWidget extends StoreConnector<MyReduxState, MyReduxStateBuilder, MyReduxStateActions,
    MyWidgetProps, MyWidgetPropsBuilder> {
  MyWidget({Key key}) : super(key: key);

  @override
  MyWidgetProps connect(Store<MyReduxState, MyReduxStateBuilder, MyReduxStateActions> store) =>
      new MyWidgetProps((b) => b..propIWantFromMyReduxState = store.state.someProperty)

  MyWidgetState createState() => new MyWidgetState();
}

class MyWidgetState extends StoreConnectorState<MyReduxState, MyReduxStateBuilder,
    MyReduxStateActions, MyWidgetProps, MyWidgetPropsBuilder> {

  Widget build(BuildContext context) {
    return new Center(
      child: new Text(state.propIWantFromMyReduxState),
    );
  }

would now be

abstract class MyWidgetProps implements Built<MyWidgetProps, MyWidgetPropsBuilder> {
  String get propIWantFromMyReduxState;
  MyWidgetProps._();
  factory MyWidgetProps([updates(MyWidgetPropsBuilder b)]) => _$MyWidgetProps;
}

class MyWidget extends StoreConnector<MyReduxState, MyReduxStateBuilder, MyReduxStateActions, MyWidgetProps> {
  MyWidget({Key key}) : super(key: key);

  @override
  MyWidgetProps connect(MyReduxState state) =>
      new MyWidgetProps((b) => b..propIWantFromMyReduxState = state.someProperty);

  Widget build(BuildContext context, MyWidgetProps state, MyReduxStateActions actions) {
    return new Center(
      child: new Text(state.propIWantFromMyReduxState),
    );
  }

0.1.0

28 Sep 05:52
Compare
Choose a tag to compare

0.1.0