Skip to content

Commit

Permalink
Improved setState in StoreProvider.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcglasberg committed Mar 9, 2024
1 parent e42f531 commit 6e42fe5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ an <a href="https://github.com/marcglasberg/SameAppDifferentTech/blob/main/Mobil
Async Redux App Example Repository</a> in GitHub for a full-fledged example with a complete app
showcasing the fundamentals and best practices described in the AsyncRedux README.md file._

# 22.0.0-dev.8
# 22.0.0-dev.9

* A few features of the async_redux package are now available as a standalone Dart-only
package: https://pub.dev/packages/async_redux_core. You may use that core package when you
Expand Down
6 changes: 4 additions & 2 deletions lib/src/store_provider_and_connector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,10 @@ class _StatefulWrapperState<St> extends State<_StatefulWrapper<St>> {
void initState() {
super.initState();
widget.store.onChange.where(_stateChanged).listen((St state) {
_recentState = state;
setState(() {});
if (mounted) {
_recentState = state;
setState(() {});
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: async_redux
description: Redux state management. An optimized Redux version, which is very easy to learn and use, yet powerful and tailored for Flutter. It allows both sync and async reducers.
version: 22.0.0-dev.8
version: 22.0.0-dev.9
# author: Marcelo Glasberg <[email protected]>
homepage: https://github.com/marcglasberg/async_redux
topics:
Expand Down

0 comments on commit 6e42fe5

Please sign in to comment.