I am learning flutter and trying to integrate with redux for store managment.
All the examples I see the store is accessed in the render part of the widget, for example like so:
Padding(
padding: EdgeInsets.all(2.0),
child: StoreConnector<AppState, List<Photo>>(
converter: (store) => store.state.photos,
builder: (_, photos) {
return GridView.builder(
itemCount: photos.length,
itemBuilder: (BuildContext context, int index) {
final photoUrl = photos[index].portrait;
return Padding(
padding: EdgeInsets.all(1.0),
child: new Image.network(
photoUrl,
fit: BoxFit.cover,
),
);
},
gridDelegate:
// .......
but how to get a value from the store in initState, and detect if that value changes, for example? And can I have a listener for certain value outside the render tree?
Thank you.
Edit for clarity, what I am looking for is some Flutter equivalent of react's useSelector being able to get the change in value in useEffect
Edit: I was thinking that an option (though not the answer to the question) could be to pass the values from the parent and then use didChangeDependencies() in the child