title: pushReplacement or pushAndRemoveUntil(Route<dynamic> route) => false not Working
body: <p>A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.
  'package:flutter/src/widgets/navigator.dart':
  Failed assertion: line 3075 pos 7: '!hasPage || isWaitingForExitingDecision'</p>
  <p>Only Navigator.push works. Before Flutter 2 it was working.</p>
  <pre><code>Navigator.pushAndRemoveUntil(
                      context,
                      PageRouteBuilder(
                        transitionDuration: const Duration(milliseconds: 3300),
                        transitionsBuilder: (BuildContext context,
                            Animation&lt;double&gt; animation,
                            Animation&lt;double&gt; secondaryAnimation,
                            Widget child) {
                          return _CustomPageTransition(
                              routeAnimation: animation,
                              fullscreenDialog: false,
                              child: child);
                        },
                        pageBuilder: (_, __, ___) =&gt; LoginScreen(),
                      ),
                      (route) {
                        print(route.settings.name);
                        return false;
                      });
  </code></pre>