Comments (2)
Hey hey :) Always good questions, @kentcb. Really interesting, thanks for posting these issues! Please keep doing so!
I have two methods on the StoreConnector
and StoreBuilder
widgets for exactly this case:
onInit
and onDispose
. E.g.
return new StoreConnector(
onInit: (store) => store.dispatch(new InitAction()),
onDispose: (store) => store.dispatch(new DisposeAction()),
converter: ...,
builder: ...,
}
Does this work for your use case? If not, It's kind of a funny hack the way it works: StoreConnector
builds a StatefulWidget
under the hood. StoreConnector
grabs the Store
in the build method and passes it to the StatefulWidget, so it's available in the initState
method. You could follow a similar approach.
from flutter_redux.
Oh, that's perfect for my use case. I wasn't aware of those callbacks - super useful, thanks!
from flutter_redux.
Related Issues (20)
- The value 'null' can't be assigned to a variable of type 'ViewModel' because 'ViewModel' is not nullable.
- Receive the action that caused the state update in StoreConnector hooks
- [Question]: Mixing global and local state
- 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
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.