-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
counter demo: UI doesn't update after hot reload #57
Comments
Hey there -- took a look at your code. The problem is that you're creating the This means you're creating a new store each time the build method is called, and that's why you're running into trouble. Instead, you need to create the Store exactly once: Either in the Please try this as an alternative and everything should be working: import 'package:firebaseredux/models/app_state.dart';
import 'package:firebaseredux/pages/home_page.dart';
import 'package:firebaseredux/reducers/app_reducer.dart';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';
import 'package:redux_logging/redux_logging.dart';
void main() => runApp(new MusicParty());
class MusicParty extends StatefulWidget {
@override
MusicPartyState createState() {
return new MusicPartyState();
}
}
class MusicPartyState extends State<MusicParty> {
final store = Store<AppState>(
appReducer,
initialState: new AppState(count: 0, isLoading: false),
middleware: [LoggingMiddleware.printer()],
);
@override
Widget build(BuildContext context) {
final title = "Me Suite";
return new StoreProvider<AppState>(
store: store,
child: MaterialApp(
title: title,
home: HomePage(title),
),
);
}
} |
Thank you. Now everything works as expected. |
This will still fail with persist, load the store asnyc as the app loads with the following.
|
Thank you, you saved my life!! |
I'm following the tutorial from https://flutterbyexample.com/redux-app-getting-to-start
However, when I hot reload, the UI does not update with the new value. This issue is same as #42 . Btw, hot reload works fine on other projects without using redux. Another interesting thing is that after hot reloading, the logger middleware prints the same message twice for a single tap event.
Here is the output from
flutter doctor
:I've attached the contents of lib folder and pubspec.yaml
firebaseredux.zip
The text was updated successfully, but these errors were encountered: