flutter web navigation 2 detect browser back

Viewed 197

This is the build function of MyApp:

    return MaterialApp.router(
  routerDelegate: MainRouterDelegate(),
  routeInformationParser: MainRouteInformationParser(),
);

This is the build function of MainRouterDelegate:

    @override
  Widget build(BuildContext context) {
    return Navigator(
      key: navigatorKey,
      observers: [
        FirebaseAnalyticsObserver(analytics: analytics),
      ],
      pages: [
        MaterialPage(child: getFirstScreen(isMentor, userId, meetingId, isSchedule, action)),
      ],
      onPopPage: (route, result) {
        if (!route.didPop(result)) return false;
        show404 = false;
        notifyListeners();
        return true;
      },
    );
  }
  1. I want to ignore the back button (android device and browser).
  2. When exactly is 'onPopPage' called?
0 Answers
Related