Flutter 2.0 pushAndRemoveUntil not working
975
You can access your MaterialApp navigator with rootNavigator: true. See https://api.flutter.dev/flutter/widgets/Navigator/of.html. Try the following it is working.
Navigator.of(context, rootNavigator:
true).pushAndRemoveUntil(MaterialPageRoute(builder: (context) =>
SignInPage()), (route) => false);
Author by
mtical
Updated on December 30, 2022Comments
-
mtical over 1 year
Not sure how to clear the stack and route to a new page after implementing the Flutter 2.0 routing.
The following isn't working:
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => SignInPage()), (route) => false);
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3075 pos 7: '!hasPage || isWaitingForExitingDecision': A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.
-
mtical almost 3 yearsSame error:
Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3075 pos 7: '!hasPage || isWaitingForExitingDecision': A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.
-
mtical almost 3 yearsSame error:
Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3075 pos 7: '!hasPage || isWaitingForExitingDecision': A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.