pushAndRemoveUntil<T> method
Equals to Navigator.of(context).pushAndRemoveUntil()
Just give it the route
you want to push
Example
context.pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => CounterPage()));
Implementation
Future<T?> pushAndRemoveUntil<T>(
Route<T> route, {
bool Function(Route<dynamic>)? predicate,
}) async =>
Navigator.of(this).pushAndRemoveUntil<T>(
route,
predicate ?? (_) => false,
);