push static method

Future push(
  1. BuildContext context, {
  2. required Widget screen,
  3. bool isCupertinoPush = true,
})

Pushes a new route onto the navigation stack.

context: The build context from which to navigate. screen: The widget to display as the new screen. isCupertinoPush: If true, uses a CupertinoPageRoute for iOS-style transitions. Otherwise, uses a MaterialPageRoute. Defaults to true.

Implementation

static Future push(
  BuildContext context, {
  required Widget screen,
  bool isCupertinoPush = true,
}) async {
  if (isCupertinoPush) {
    return Navigator.push(
      context,
      CupertinoPageRoute(
        builder: (context) {
          return screen;
        },
      ),
    );
  } else {
    return Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) {
          return screen;
        },
      ),
    );
  }
}