pushAndRemoveUntil<T> static method

Future<T?> pushAndRemoveUntil<T>(
  1. Widget page, {
  2. String? routeName,
  3. bool predicate(
    1. Route
    )?,
})

Implementation

static Future<T?> pushAndRemoveUntil<T>(
  Widget page, {
  String? routeName,
  bool Function(Route<dynamic>)? predicate,
}) {
  return Navigator.of(currentContext!).pushAndRemoveUntil<T>(
    MaterialPageRoute(
      builder: (context) => page,
      settings: routeName != null ? RouteSettings(name: routeName) : null,
    ),
    predicate ?? (_) => false,
  );
}