Home > Back-end >  Navigator.pop does not closing showModalBottomSheet when the StartWidget is displayed again
Navigator.pop does not closing showModalBottomSheet when the StartWidget is displayed again

Time:08-27

I have the following route: StartWidget -> showModalBottomSheet -> NextWidget -> NextWidget: Doing some work and calls finally Navigator.pop and showing MainWidget but with open showModalBottomSheet.

Which navigator method do i have to use, in order to display only the StartWidget?

Thanks

CodePudding user response:

Navigator.pushNamed returns a Future. As such, perhaps if you just add the await like so

void goToNextPage() async {
<...do something 1...>
await Navigator.pushNamed(context, screenName);
<...do something 2...> //open bottom sheet
}

It can solve the issue.

CodePudding user response:

If I understood your question correctly, I think you can use the popUntil method to get back to the StartWidget, the documentation is here:

[https://api.flutter.dev/flutter/widgets/Navigator/popUntil.html][1]

  • Related