I am having an issue, I am getting google place information from one Widget, and I am sending that information to another Widget, in the first one, it seems to be working fine, but inside the other widget, the change is not reflected 'till the page is reloaded
UserCurrentPlace
class _UserCurrentPlaceState extends State<UserCurrentPlace> {
_UserCurrentPlaceState();
@override
Widget build(BuildContext context) {
return new StoreConnector<ReduxState, UserCurrentPlaceViewModel>(
converter: (store) {
return new UserCurrentPlaceViewModel(
currentUserPlace: store.state.currentUserPlace,
onUserPlaceRatingChanged: (isRatingPlace) =>
store.dispatch(new SetUserPlaceRating(isRatingPlace)),
onCurrentUserPlaceChanged: (currentUserPlace) =>
store.dispatch(new SetCurrentUserPlace(currentUserPlace)));
},
builder: (context, vm) {
return FutureBuilder<GooglePlace>(
future: GooglePlaceAPIHelper.getPlaceInformation(vm.currentUserPlace.placeModel.googleId),
builder: (context, snapshot) {
if (snapshot.hasData) {
return new PlaceProfile(snapshot.data, true);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
return Utility.getLoading();
},
);
},
);
}
}
It calls to PlaceProfile, but inside it, it still has the previous name, I mean, the redux status is changed, it's reflected in the UserCurrentPlace, so, I got new data from Google, but PlaceProfile is not updated with the new information. By the way, the widget that I want to update is inside a section of flutter_gallery.
class PlaceProfileState extends State<PlaceProfile> {
PlaceProfileState(this._place, this.isCurrentPlace);
final GooglePlace _place;
bool isCurrentPlace;
@override
Widget build(BuildContext context) {
return Text(_place.name);
}
}
class PlaceProfile extends StatefulWidget {
PlaceProfile(this._place, this.isCurrentPlace);
final GooglePlace _place;
final bool isCurrentPlace;
@override
PlaceProfileState createState() =>
new PlaceProfileState(this._place, this.isCurrentPlace);
}