Hello,
I'm trying to make a form and one of the fields I'm using "flutter_google_places" to pick up a place, it basically opens a new page (widget) and after I pick a place it pops the widget returning the chosen place, the problem here is that when the page is pop my form is being reset to initial state.
Below method _getAutoCompletePrediction is responsible for opening the google places page to pick a place up.
onAddDestinationation triggers a event that includes the chosen place in the state, however after that the state gets reset.
_placesAutocomplete() async {
Prediction p = await _getAutoCompletePrediction("Pesquisar");
final _saveGroupBloc = BlocProvider.of<SaveGroupBloc>(context);
if (p != null && p.structuredFormatting.mainText.isNotEmpty) {
_saveGroupBloc
.onAddDestination(Destination(placesId: p.placeId, name: p.structuredFormatting.mainText));
}
}
Is there any way to do it without resetting my state to initial state?
Thanks in advance,
Hi @rlfrenato 馃憢
Thanks for opening an issue!
Can you share a sample application with the issue you're having? Is your Form Widget a StatefulWidget? Also, to clarify is your form state being reset or is the bloc state being reset? Thanks!
Thanks for the quick reply, will create a sample app and share here
When creating the sample app I have not faced the issue, I'm maybe missing something in my other code, will dig further. For now I think the issue can be closed.
Sorry :S
Sounds good! Feel free to reach out with any additional questions 馃憤
Most helpful comment
Thanks for the quick reply, will create a sample app and share here