workiva / built_redux Goto Github PK
View Code? Open in Web Editor NEWan implementation of redux written in dart that enforces immutability
License: MIT License
an implementation of redux written in dart that enforces immutability
License: MIT License
I'm trying to used latest 7.4.5 version of built_redux, but 'flutter packages upgrade' and 'flutter packages get' are failing.
This is one message:
The current Dart SDK version is 2.0.0-dev.58.0.flutter-f981f09760.
Because XXX depends on build_runner >=0.9.0 which requires SDK version >=2.0.0-dev.61 <3.0.0, version solving failed.
I'm not sure how to upgrade the dart SDK - how is it that build_runner depends on a newer SDK?
If I add in this dev_dependencies:
flutter_test:
sdk: flutter
Then I get a different error:
Because no versions of built_value_generator match >6.0.0 <7.0.0 and built_value_generator 6.0.0 depends on analyzer ^0.32.1, built_value_generator ^6.0.0 requires analyzer ^0.32.1.
And because every version of flutter_test from sdk depends on analyzer 0.31.2-alpha.2, built_value_generator ^6.0.0 is incompatible with flutter_test from sdk.
So, because XXX depends on both flutter_test any from sdk and built_value_generator ^6.0.0, version solving failed.
I'm a little new to flutter, so wondering if you have any advice on the proper version to get things working?
Here's output of flutter doctor:
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[✓] Connected devices (1 available)
can you add rehydrate store from device storage when open the app? Thank you!
I'm trying to figure out the best pattern for creating reusable chunks of redux, particularly for reducers and middleware because state and actions are easy. I think NestedReducerBuilder
provides a workable means for doing this type of thing, but there isn't really a similar option for Middleware
.
For a basic idea of what I'm trying to do (pseudocode):
class UserState { String get username; }
class UserActions {
ActionDispatcher<String> login;
ActionDispatcher<String> loginResult;
}
void loginReducer(UserState state, Action<String> loginResult, UserStateBuilder builder) {
builder..username = loginResult.payload
}
Middleware<UserState state, UserStateBuilder, UserActions> createUserMiddleware() {
return (MiddlewareBuilder<UserState, UserStateBuilder, UserActions>()
..add(UserActionsNames.login, submitLogin)
).build();
}
class PuzzleState { bool get isSolved; }
class PuzzleActions { /* check-solution, other actions */ }
// Similar things with reducers and middleware
class AppState {
UserState userState;
PuzzleState puzzleState;
}
The objective here is to have the User-related code know nothing about Puzzle- or App-related code (That way, I can test it independently and re-use it in other projects.) while being able to use the createUserMiddleware
at the App-level.
Unless we can get all the generated code to abide by all the rules.
See dart-lang/linter#165 for some options. Perhaps just // ignore_for_file: linter_rule
in each generated file?
Hi
First of all, thank you all for this library, it is just amazing. I´ve enjoyed learning this architecture and implementing it on a project in the company where a I´m working now.
I'm really new to Flutter and Dart, so I have a question. I want to use a pull to refresh which sends an action and retrieves a new set of items from the rest api via the middleware. I need to use RefreshIndicator, but the indicator needs a Future passed to it (onRefresh) that resolves when the action has finished. Is there any way that I can use the existing stock widget to start and stop based on actions?
Thank you in advance!
I am using a built_redux_repatch with a dev brunch. The BuiltReduxGenerator does not recognize ValueBuilders. For a example:
ActionDispatcher<Repatch<AppState, AppStateBuilder>> repatchDispatcher;
leads to:
final ActionDispatcher<dynamic Function(AppState, dynamic)>
repatchDispatcher =
new ActionDispatcher<dynamic Function(AppState, dynamic)>(
'AppActions-repatchDispatcher');
Not generated class instead of a builder generates fine:
ActionDispatcher<Repatch<AppState, AppState>> repatchDispatcher;
leads to:
final ActionDispatcher<dynamic Function(AppState, AppState)>
repatchDispatcher =
new ActionDispatcher<dynamic Function(AppState, AppState)>(
'AppActions-repatchDispatcher');
First, I want to congratulate you guys on the awesome work on this project.
I saw some example projects and they all have .g.dart files committed. Any reason for that? It's safe for me to add them to .gitignore?
Thanks.
Hey hey :)
I've been exploring different ways to do State Management in Flutter and decided I'd go ahead and build a "TodoMVC" type repo that showcases different architectures for the same app (a todo app, no surprises!).
I didn't know the best way to contact you, so I just thought I'd pop an issue in here. I'm trying to make sure the Architecture Samples are high quality and reflect your vision for how this library is meant to be used, so I'd love it if you had any feedback on the code I've written. I've also included a comparison to normal Redux
and want to make sure you find the comparison fair, so please feel free to comment on the README as well!
https://gitlab.com/brianegan/flutter_architecture_samples/tree/master/example/built_redux
Happy to accept Merge Requests or chat more here with how it could be improved.
Best,
Brian
store .substateStream<UserState>((AppState appState) => appState.user) .listen((onData) { print("user changed"); });
above line is giving me following compile time error any suggestion how to get away with this
Error: The function expression type '(#lib1::AppState) → #lib2::UserState' isn't of expected type '(#lib3::Built<dynamic, dynamic>) → #lib2::UserState'. Change the type of the function expression or the context in which it is used. .substateStream<UserState>((AppState appState) => appState.user)
For cases where you just want to trigger an action that doesn't have a payload it would be nice to not have to pass in null
What are your thoughts?
when i'm use built_redux, and flutter packages get, it's always not responding.
i'm use flutter 3.1 beta.
Redux.js has this feature which makes it pretty easy to interact with something like an network request. Will this library support that? Or what is the recommended way of interacting with async state changes?
Somewhat related to #88, I'd like to be able to adapt a ReducerBuilder
into a NestedReducerBuilder
. I think the easiest approach for that will be to create an addAll
method on NestedReducerBuilder
. I'll be working on a PR for this and hope to have something to share later today.
This is a lame defect because I updated flutter and i don't know what version of flutter i came from. During that update everything broke and I never realized that i don't have a way to revert to a specific versoin of flutter. My code that worked on that version no longer worked on the updated version due to libraries being incompatible. After making all of the required library updates to work with the updated flutter I find myself with a version of built_value_generator that doesn't generate the files anymore. I'm not sure though if this is the fault of built_value_generator or built_redux. The portion of the built_redux file (actions.g.dart) that is the redux code works but the portion of the actions file that is from built_value_generator isn't there and all of the remaining *.g.dart files are not being generated. Any help or even just guidance on how to debug something being run by build_runner.
pubspec.yaml
dependencies:
#flutter:
# sdk: flutter
#flutter_localizations:
# sdk: flutter
meta: ^1.0.4
fluro: ^1.3.5
flutter_built_redux: ^0.6.0
built_redux: ^7.5.0
built_collection: '>=2.0.0 <5.0.0'
built_value: '>=5.5.5 <7.0.0'
intl: any
intl_translation: any
path_provider: ^0.4.1
built_redux_rx: ^0.1.2
cloud_firestore: ^0.8.1
cloud_functions: ^0.0.4
firebase_auth: ^0.6.2
firebase_dynamic_links: ^0.1.0
google_sign_in: ^3.2.1
rxdart: ^0.19.0
ulid: ^1.0.1
dev_dependencies:
#flutter_test:
# sdk: flutter
#flutter_driver:
# sdk: flutter
built_value_generator: ^6.1.4
build_runner: '>=0.9.0 <0.11.0'
test: ^1.0.0
quiver: '>=0.21.0 <3.0.0'
dependency_overrides:
rxdart: ^0.19.0
build.dart in .dart_tool
import 'package:build_runner/build_runner.dart' as _i1;
import 'package:built_redux/builder.dart' as _i2;
import 'package:built_value_generator/builder.dart' as _i3;
import 'package:source_gen/builder.dart' as _i4;
import 'package:build_config/build_config.dart' as _i5;
import 'dart:isolate' as _i6;
final _builders = <_i1.BuilderApplication>[
_i1.apply('built_redux|built_redux', [_i2.builtRedux],
_i1.toDependentsOf('built_redux'),
hideOutput: true, appliesBuilders: ['source_gen|combining_builder']),
_i1.apply('built_value_generator|built_value', [_i3.builtValue],
_i1.toDependentsOf('built_value_generator'),
hideOutput: true, appliesBuilders: ['source_gen|combining_builder']),
_i1.apply('source_gen|combining_builder', [_i4.combiningBuilder],
_i1.toNoneByDefault(),
hideOutput: false, appliesBuilders: ['source_gen|part_cleanup']),
_i1.applyPostProcess('source_gen|part_cleanup', _i4.partCleanup,
defaultGenerateFor: const _i5.InputSet())
];
main(List<String> args, [_i6.SendPort sendPort]) async {
var result = await _i1.run(args, _builders);
sendPort?.send(result);
}
The documentation in store.md appears to be cut off.
David, can you bump up the version of build_runner, to the latest?
Thanks in advance
Using the counter example, the listen event appears out of order with respect to the program order. The call store.stream.listen((_) => print(store.state.count));
always just print the final count, as if the call was differed after all updates. This is confirmed using the following simple example:
store.stream.listen((event) => print("listen: ${event.prev.count} -> ${event.next.count}"));
print("current value: ${store.state.value});
store.actions.increment(1);
print("current value: ${store.state.value});
output:
current value: 0
current value: 1
listen: 0 -> 1
I was expecting that the listen callback would be called from within the event dispatching, but it seems they are queued and batched. I wonder why this behaviour occurs. We might change the example to used the StoreChange argument instead of the global store to yield the expected result.
Hi
I have an AppState and a nested MenuState.
Actions on the AppState trigger the reducer and that then triggers the UI to update.
Actions on the nested MenuState trigger the nested reducer BUT do not trigger the UI to update.
Is this a bug or am I doing something wrong?
If there is nothing obvious in my following code, would you be so kind and provide an example with a nested action and reducer that actually triggers an update using the flutter_built_redux
StoreConnection
?
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v0.5.4, on Microsoft Windows [Version 10.0.17134.112], locale en-NZ)
[√] Android toolchain - develop for Android devices (Android SDK 26.0.2)
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2017.3)
store
Store<AppState, AppStateBuilder, AppActions> createStore() {
return new Store<AppState, AppStateBuilder, AppActions>(
appReducerBuilder.build(),
new AppState.loading(),
new AppActions(),
middleware: [
createFirebaseMiddleware(),
],
);
}
middleware
final Firestore firestore = Firestore.instance;
Middleware<AppState, AppStateBuilder, AppActions> createFirebaseMiddleware() {
return (new MiddlewareBuilder<AppState, AppStateBuilder, AppActions>()
..add(AppActionsNames.connectFirestoreAction, connectFirestore))
.build();
}
connectFirestore(MiddlewareApi<AppState, AppStateBuilder, AppActions> api,
ActionHandler next, Action<Null> action) {
firestore
.collection("menus/P1N09rgDMAgc5u2KrIIT/items")
.orderBy("sortOrder")
.snapshots()
.listen((QuerySnapshot snapshot) {
BuiltList<MenuItem> menuItems =
documentsToBuiltList<MenuItem>(snapshot.documents, MenuItem.serializer);
api.actions.menu.menuItemsLoadedSuccessAction(menuItems);
});
next(action);
}
app_state
part 'app_state.g.dart';
abstract class AppState implements Built<AppState, AppStateBuilder> {
static Serializer<AppState> get serializer => _$appStateSerializer;
factory AppState([updates(AppStateBuilder b)]) = _$AppState;
AppState._();
BuiltList<Shop> get shops;
@nullable
MenuState get menuState;
menu_state
part 'menu_state.g.dart';
abstract class MenuState implements Built<MenuState, MenuStateBuilder> {
static Serializer<MenuState> get serializer => _$menuStateSerializer;
factory MenuState([updates(MenuStateBuilder b)]) = _$MenuState;
MenuState._();
@nullable
String get id;
BuiltList<MenuItem> get menuItems;
@nullable
String get title;
}
menu_item
part 'menu_item.g.dart';
abstract class MenuItem implements Built<MenuItem, MenuItemBuilder> {
static Serializer<MenuItem> get serializer => _$menuItemSerializer;
factory MenuItem([updates(MenuItemBuilder b)]) = _$MenuItem;
MenuItem._();
@nullable
String get currency;
@nullable
String get description;
String get id;
@nullable
double get price;
int get sortOrder;
String get title;
int get type;
}
app_actions
part 'app_actions.g.dart';
abstract class AppActions extends ReduxActions {
ActionDispatcher<Null> connectFirestoreAction;
ActionDispatcher<BuiltList<Shop>> shopsLoadedSuccessAction;
factory AppActions() => new _$AppActions();
AppActions._();
MenuActions get menu;
}
menu_actions
part 'menu_actions.g.dart';
abstract class MenuActions extends ReduxActions {
ActionDispatcher<BuiltList<MenuItem>> menuItemsLoadedSuccessAction;
factory MenuActions() => new _$MenuActions();
MenuActions._();
}
app_reducer
final appReducerBuilder = new ReducerBuilder<AppState, AppStateBuilder>()
..add(AppActionsNames.shopsLoadedSuccessAction, shopsLoadedSuccess)
..combineNested<MenuState, MenuStateBuilder>(menuReducerBuilder);
menu_reducer
final menuReducerBuilder =
new NestedReducerBuilder<AppState, AppStateBuilder, MenuState, MenuStateBuilder>(
(s) => s.menuState,
(b) => b.menuState) // maps from the main state object to the nested state
..add(MenuActionsNames.menuItemsLoadedSuccessAction, menuItemsLoadedSuccess);
void menuItemsLoadedSuccess(MenuState state, Action<BuiltList<MenuItem>> action,
MenuStateBuilder builder) {
builder.menuItems.replace(action.payload);
}
menu_widget
class MenuWidget extends StatefulWidget {
@override
MenuWidgetState createState() => MenuWidgetState();
}
class MenuWidgetState extends State<MenuWidget>
with SingleTickerProviderStateMixin {
// ...
@override
Widget build(BuildContext context) {
return StoreConnection<AppState, AppActions, BuiltList<MenuItem>>(
connect: (state) => state.menuState.menuItems,
builder: (BuildContext context, BuiltList<MenuItem> menuItems,
AppActions actions) {
print(menuItems); // not printed when nested action triggers nested reducer :(
return Scaffold(
// ...
floatingActionButton: FloatingActionButton(
child: Icon(Icons.control_point),
onPressed: () {
actions.connectFirestoreAction();
},
),
// ...
Hi guys
I´m developing an application using built_redux, but I need that some componets and modules can be reused in other applications. For instance, if we develop a dashboard module, it needs to be reused in other applications.
As you know, when we create a module, it needs an aplication state (AppState), actions, middleware, reducer, and views.
My questios is, there is a way to reuse middleware, reducers, actions and state?
there is a pattern to extend states?
I appreciate you help
Thank you in advance
Both "flutter packages get" and "pub get "get stuck and fail to complete.
I opened this issue over against built_value_generator but i'm not sure if the issue if built_redux, built_value_generator or source_gen.
Thought i'd open this here to see if anybody has any idea what is going wrong or has experience with debugging build_runner/source_gen.
Flutter master v0.4.4 requires analyzer: ^0.31.2-alpha.2
Hi guys
looks like newer versions break this.
Looks like its not generating code unless you implement implements Built<......>
.
Here is the example with your own test files:
My package yml with the latest versions:
name: redux_immutable_flutter
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
#flutter_built_redux: ^0.0.2
built_redux: ^5.1.0
built_collection: ^1.5.0
built_value: ^4.2.0
dev_dependencies:
flutter_test:
sdk: flutter
build: ^0.10.2
build_runner: ^0.5.0
built_value_generator: ^4.2.0
source_gen: ^0.7.1
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/.
# To add assets from package dependencies, first ensure the asset
# is in the lib/ directory of the dependency. Then,
# refer to the asset with a path prefixed with
# `packages/PACKAGE_NAME/`. The `lib/` is implied, do not
# include `lib/` in the asset path.
#
# Here is an example:
#
# assets:
# - packages/PACKAGE_NAME/path/to/asset
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
Please see:
https://github.com/davidmarne/built_redux/blob/master/doc/basics/reducers.md
abstract class Counter implements Built<Counter, CounterBuilder> {
Counter._();
factory Counter() => new _$Counter._(count: 0);
int get count;
}
void counterReducer(App prevState, Action<dynamic> action, AppBuilder builder) {
if (action.name == AppActionsNames.increment.name)
builder.count += action.payload as int;
else if (action.name == AppActionsNames.decrement.name)
builder.count -= action.payload as int;
}
Should App be Counter and AppBuilder be CounterBuilder?
I'd like to find out if there is a prescribed way to use the Navigator
when using built_redux
.
I have a screen that has a button to trigger a call to the server - the button dispatches an Action
that is handled by Middleware
. The Middleware
sends a request to the server and dispatches a success or error action depending on the result. I have reducers update the state depending on the result, which redraws the current screen. That's fine if the response was an error because we want to display it on the same screen.
However, if the server response was successful, I want to navigate to a different screen, but I haven't found a clean way to do that. (Creating a delayed future in the StoreConnector
seems wrong, and calling the Navigator
from the build
method triggers an error.)
pub get
and pub upgrade
should show all dependencies where newer versions are available.
I tried to add a 2nd level of nesting but NestedReducerBuilder
doesn't have a combineNested
method.
Am I missing something?
Also combine
is not available on NestedReducerBuilder
Hi,
I have an issue when execute the build_runner command after I update to the flutter last version in stable channel.
The error displayed is the following
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1837:19: Error: Type 'SetLiteral' not found.
visitSetLiteral(SetLiteral node) {
^^^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/dart_formatter.dart:117:12: Error: The setter 'enableSetLiterals' isn't defined for the class 'analyzer.parser::Parser'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'enableSetLiterals'.
parser.enableSetLiterals = true;
^^^^^^^^^^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1837:19: Error: 'SetLiteral' isn't a type.
visitSetLiteral(SetLiteral node) {
^^^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1839:20: Error: The getter 'leftBracket' isn't defined for the class 'invalid-type'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'leftBracket'.
node, node.leftBracket, node.elements, node.rightBracket);
^^^^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1839:38: Error: The getter 'elements' isn't defined for the class 'invalid-type'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'elements'.
node, node.leftBracket, node.elements, node.rightBracket);
^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1839:53: Error: The getter 'rightBracket' isn't defined for the class 'invalid-type'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'rightBracket'.
node, node.leftBracket, node.elements, node.rightBracket);
^^^^^^^^^^^^
file:///C:/Users/jorjuela/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.2/lib/src/source_visitor.dart:1839:9: Error: The argument type 'invalid-type' can't be assigned to the parameter type '#lib1::TypedLiteral'.
Try changing the type of the parameter, or casting the argument to '#lib1::TypedLiteral'.
node, node.leftBracket, node.elements, node.rightBracket);
I saw that build, build_runner, and built_value_generator were updated, but I´m not sure if those libraries need to be updated on built_redux to fix this issue.
Thank you in advance
I wanted to use flutter_built_redux
, but when running flutter packages get
, the following error appears:
Because built_redux >=7.4.5 depends on analyzer ^0.32.1 and built_redux >=0.0.3 <7.4.5 requires SDK version >=1.17.1 <2.0.0 or >=2-0-0-dev <2.0.0, built_redux >=0.0.3 requires analyzer ^0.32.1.
And because every version of flutter_test from sdk depends on analyzer 0.33.0 and flutter_built_redux >=0.6.0 depends on built_redux >=6.1.1 <8.0.0, flutter_test from sdk is incompatible with flutter_built_redux >=0.6.0.
So, because my_project_name depends on both flutter_built_redux ^0.6.0 and flutter_test any from sdk, version solving failed.
This is only happening with the master or dev channel of flutter, the beta channel works fine.
E.g. by adding an optional tracing Span
on ActionDispatcher
or Action
.
Hi guys
I'm building a app which loads data in a list view by chunks (pagination) with smart (StoreConnector) and dumb (StatelessWidget) components.
There is a way to manage the scroll state using built_redux?
Thank you in advance
for actions or remove new
from generated code
built_collection is at 2.0.0 and not compatible with built_redux which only supports ^1.0.0
by making the StreamController sync?
In the Flux docs they mention that the actions should be sync and that they are async makes especially testing cumbersome, but also some code where I have more than one action where the later ones depend on the previous one to have completed.
If reducers have no side effects besides updating the store, there should be no need to execute them async.
Are there other ways to ensure the reducer for an action was executed than listening for store changes?
Hello,
I want listen store change on event named "AppActionsNames.startLoginFlow" and it changes single variable in AppState ... bool get startedLoginFlow;
store.actionStream(AppActionsNames.startLoginFlow).listen((StoreChange<AppState, AppStateBuilder, Action<Null>> change)
When action occurs, i got an error
Action {
name: AppActions-startLoginFlow,
payload: null,
}
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
type 'StoreChange<AppState, AppStateBuilder, dynamic>' is not a subtype of type 'StoreChange<AppState, AppStateBuilder, Null>' in type cast where
Replacing Action<Null>
to Null
and dynamic
doesnt help.
I've started a project on Flutter and I'm really interested in build_redux ( and frankly all the built_philosophy ), is this a acceptable to start a project on this lib ? question is mainly about support of the lib ?
Thank you David
but not yet supported by built_redux
I have a situation where I need the actions from the store, but not any state. So, I setup a widget like this:
class LoginLayout extends StoreConnector<AppState, AppActions, AuthState> {
final GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
final GlobalKey<FormFieldState<String>> _emailKey = new GlobalKey<FormFieldState<String>>();
final GlobalKey<FormFieldState<String>> _passwordKey = new GlobalKey<FormFieldState<String>>();
@override
AuthState connect(AppState state) => state.auth;
@override
Widget build(BuildContext context, AuthState state, AppActions actions) {
print('render login layout $state');
return new Scaffold(
appBar: new AppBar(
title: new Text('Veoci Login'),
),
body: new Form(
key: _formKey,
autovalidate: true,
child: new Container(
padding: new EdgeInsets.all(16.0),
child: new Column(
children: <Widget>[
new TextFormField(
key: _emailKey,
validator: _validate,
autofocus: true,
decoration: new InputDecoration(icon: const Icon(Icons.person), labelText: 'Email'),
),
new TextFormField(
key: _passwordKey,
validator: _validate,
decoration: new InputDecoration(
icon: const Icon(Icons.lock),
labelText: 'Password',
),
obscureText: true,
onFieldSubmitted: (String value) {
_handleSubmitted(context);
},
),
new Container(
padding: const EdgeInsets.symmetric(vertical: 20.0),
alignment: Alignment.centerRight,
child: new RaisedButton(
child: new Text('Submit'),
onPressed: () {
_handleSubmitted(context);
}))
],
),
)),
);
}
...
}
FYI I am refactoring this from use with redux_dart in favor of built_redux since I've used built_value for my models.
Anyway, I'm not doing anything special here, but when the TextFormField
with autofocus: true
is focused the _AnimatedState
causes the entire state to be "dirty" and re-render LoginLayout
. I removed the StoreConnector
and turned it into a basic StatefulWidget
and the issue went away.
I'm fairly new to Flutter, so I don't quite understand the guts of the rendering engine, but something is clearly causing it to be marked dirty when StoreConnector
is used.
I tried to have a closer look at this package, but it collides with the built_value version I'm using.
Hi
the dart 2 dev instructions say remove your old build scripts
. But they don't say what the new way to build is.
So now I have no idea what to run to build the generated files.
I was looking through the notes/documentation and I want to create a nested reducer for a complex application. I would like to have the actions split into separate, maintainable files for easier organization. I see in the docs for the NestedReducerBuilder you allude to BasActionNames and ChildActionNames, but I don't see how they all get connected together as your Store
is created with something like
final store = new Store<AppState, AppStateBuilder, AppActions>(
appStateReducerBuilder.build(),
new AppState(),
new AppActions(),
middleware: []
);
which only includes the AppActions
.
I used your package 7.4.1-dev and I'm having an issue setting up the build/watch.dart files as it seems the build
and watch
functions have changed. I tried looking around for some documentation, but I can't seem to find anything.
I was hoping you could either 1) point me in the right direction to figure this out or 2) provide an example of an updated build.dart file.
I followed Brian Egan's example and placed the file in tool/build.dart
with the following attempted code:
import 'dart:async';
import 'package:build_runner/build_runner.dart';
import 'package:built_value_generator/built_value_generator.dart';
import 'package:source_gen/source_gen.dart';
import 'package:built_redux/generator.dart';
Future main(List<String> args) async {
await watch([
new BuilderApplication.forBuilder('veoci', [
(options) => new PartBuilder([
new BuiltValueGenerator(),
new BuiltReduxGenerator()
])
], (PackageNode node) {
print('$node');
return false;
})
], deleteFilesByDefault: true);
}
I get an error when running it with dart tool/build.dart
'package:build/src/builder/post_process_build_step.dart': error: line 17 pos 32: ',' or ')' expected
void Function(AssetId) addAsset,
Any advice would be greatly appreciated.
this action
abstract class TopStateAction extends ReduxActions {
ActionDispatcher<Repatch<TopState, TopStateBuilder>> repatchDispatcher;
TopStateAction._();
factory TopStateAction() => new _$TopStateAction();
}
is converted to
class _$TopStateAction extends TopStateAction{
factory $TopStateAction() => new $TopStateAction.();
$TopStateAction.() : super.();
final ActionDispatcher< **null**<TopState,TopStateBuilder> > repatchDispatcher = new ActionDispatcher<**null**<TopState,TopStateBuilder>>('TopStateAction-repatchDispatcher');
@override
void setDispatcher(Dispatcher dispatcher) {
repatchDispatcher.setDispatcher(dispatcher);
}
}
the type in actiondispather in the generated part file should not be null instead the Repatch
I tested in Dart 2.0 in Dev channel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.