toReplace function

void toReplace(
  1. Widget page, {
  2. Map<String, dynamic>? arguments,
})

Replace the current page with the provided page widget, optionally passing arguments.

Example:

toReplace(MyReplacementPage(), arguments: {'refresh': true});

Implementation

void toReplace(Widget page, {Map<String, dynamic>? arguments}) {
  Navigator.of(Utils.navigatorKey.currentContext!).pushReplacement(
    MaterialPageRoute(builder: (context) => page),
    result: arguments,
  );
}