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