push<T> method

Future<T?> push<T>(
  1. Widget screen, {
  2. bool transparent = false,
  3. bool isCupertino = false,
})

Push the given route onto the navigator.

Implementation

Future<T?> push<T>(
  Widget screen, {
  bool transparent = false,
  bool isCupertino = false,
}) {
  final RouteSettings settings = RouteSettings(
    name: screen.toString(),
  );
  if (transparent) {
    return Navigator.of(this).push<T>(
      TransparentRoute<T>(
        builder: (_) => screen,
        settings: settings,
      ),
    );
  } else {
    if (isCupertino) {
      return Navigator.of(this).push<T>(
        CupertinoPageRoute<T>(
          builder: (_) => screen,
          settings: settings,
        ),
      );
    }
    return Navigator.of(this).push<T>(
      MaterialPageRoute<T>(
        builder: (_) => screen,
        settings: settings,
      ),
    );
  }
}