Comments (12)
As a heads up: Got a workaround going to properly support generics. I'll try to push it up soon-ish!
from flutter_redux.
Same issue here, glad I'm not the only one 😅
Meanwhile I replaced the dependency in the pubspec.yaml
file with:
flutter_redux:
git:
url: git://github.com/brianegan/flutter_redux.git
ref: 0.4.0
and everything works again, thanks for your work @brianegan 💯
from flutter_redux.
Sure thing! Sorry for the delay in publishing the new version, test coverage isn't quite working with Dart 2 and I'd like to hold off until that's fixed.
That branch should totally work, however -- so feel free to play around and report issues!
from flutter_redux.
Hrm, interesting case.
I think the problem might be: you're constantly rebuilding a new Store in the build
method and handing that off to the StoreProvider
, and the library might not handling that properly.
So whenever you do a Hot Reload or that build
method is called again, it's probably rebuilding the Store and stuff is going wrong.
I'll take a deeper look. For now, could you please try moving the Store out of the build
method into an initState
and see if it works?
from flutter_redux.
I'm not sure what you mean, but I moved the app to a stateful widget, created the entire tree (starting from StoreProvider
in state's build method, but passed store
field created in initState
-- still no luck.
I'll add that initially I created store
field inline final store = ...
, much like in your sample actually. If you don't have more ideas, maybe I'll clean it up/rewrite and paste entire app for you to run?
from flutter_redux.
Yah that would be great... I haven't run into that issue before :(
from flutter_redux.
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
void main() => runApp(new TestApp());
class TestApp extends StatelessWidget {
final store = new Store<int>(
(state, action) => state + 1,
initialState: 0,
);
@override
Widget build(BuildContext context) =>
new StoreProvider<int>(
store: this.store,
child: new MaterialApp(
title: "App",
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new Scaffold(
appBar: new AppBar(
title: new Text("App"),
),
body: new MainScreen(),
),
)
);
}
class MainScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new StoreConnector<int, String>(
converter: (state) => state.toString(),
builder: (context, text) =>
new Center(
child: new Text(text),
),
);
}
}
Here it is. Only two new dependencies in pubspec:
redux: ^2.1.1
flutter_redux: ^0.3.5
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-PL)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio
[✓] Android Studio
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.4)
[!] VS Code (version 1.19.2)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.
from flutter_redux.
Yep, you found a bug! This is an interesting problem with how Dart reifies types, and my current solution doesn't quite work unfortunately ;(
For now, please use new StoreProvider
instead of new StoreProvider<int>
and it should work!
Thanks for the report, good catch!
from flutter_redux.
I encountered the same issue with the example project and just found out it happens if i have the dart 2 preview enabled.. I'm not sure if it's the same issue but disabling the preview fixes it
Cheers
from flutter_redux.
Thanks for the report! I'm actually working on a few changes that fix both this bug and adds Dart2 support :)
from flutter_redux.
Awesome !! keep up the good work!
from flutter_redux.
Will do!
from flutter_redux.
Related Issues (20)
- How to not accept change notifications when the Router is not at the top level, and then take the initiative to obtain the changes when the Router returns to the top level HOT 1
- onDidChange called twice HOT 8
- Is this package still actively maintained?
- `onWillChange` and `onDidChange` errors are swallowed HOT 4
- Warning related to `?` operator on Linux/Dev channel. HOT 2
- Import Store data type
- Widgets binding error after upgrading flutter version to 2.13.0-0.1.pre HOT 1
- onDidChange not working as expected HOT 3
- Build warning with Flutter 3.0 HOT 5
- flutter_redux depends on flutter_redux, version solving failed HOT 3
- onWillChange and onDidChange called twice after state update HOT 2
- Passing Store as an argument to MethodChannel and Background Isolate
- Question on how to use the reducer right way HOT 2
- [Question]: Any thoughts on difference between ignoreChange and distinct?
- Socket and Flutter_redux HOT 18
- Dispatching an action that does not alter state rerenders the widget, causing an infinite loop HOT 5
- How to watch redux store change inside useEffect? HOT 5
- [Question] is it expected that the store doesn't run until frames render? HOT 1
- After push a new page, and Dispatching an action, there is an infinite loop
- Is flutter redux actively maintained HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_redux.