Flutter Navigator 2.0

Nov 8 2022 · Dart 2.17.3, Flutter 3.0.2, Android Studio 2020.3

Part 3: Use the Navigation

16. Go to the Previous Page

Episode complete

Play next episode

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 15. Navigate to the Detail & ReadBook Pages Next episode: 17. Logout & Handle Back-Button

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Episode - 16 Go to Previous Page

In application coming to the previous page is also important as much as going to the next page. So lets us create a function that will handle the poping of the pages. Create a private function with name

bool _handelPopPages(Route<dynamic> route, result) {
    if (!route.didPop(result)) {
      return false;
Widget build(BuildContext context) {
  return Navigator(
    onPopPage: _handelPopPages,
    key: navigatorKey,
    pages: [],

  bool _handelPopPages(Route<dynamic> route, result) {
    if (!route.didPop(result)) {
      return false;

    if (route.settings.name == BookPages.loginPath ||
        route.settings.name == BookPages.signupPath ||
        route.settings.name == BookPages.homePath) {

    if (route.settings.name == BookPages.detailsPath) {
    if (route.settings.name == BookPages.cartPath) {
    if (route.settings.name == BookPages.settingsPath) {
    if (route.settings.name == BookPages.checkoutPath) {
    if (route.settings.name == BookPages.mybooksPath) {
    if (route.settings.name == BookPages.readBookPath) {

    return true;