pushEasyAndRemoveUntil<T> method

Future<T?> pushEasyAndRemoveUntil<T>(
  1. Widget page, {
  2. bool predicate(
    1. Route
    )?,
})

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,
    );