PlatformPageRoute<T> function Null safety

PageRoute<T> PlatformPageRoute<T>(
  1. {WidgetBuilder? builder,
  2. RouteSettings? settings,
  3. bool maintainState = true,
  4. bool fullscreenDialog = false,
  5. bool nonOpaque = true,
  6. bool forceMaterial = false,
  7. bool inPageRoute = false}
)

Creates a platform-appropriate page route.

Implementation

// ignore: non_constant_identifier_names
PageRoute<T> PlatformPageRoute<T>({
  WidgetBuilder? builder,
  RouteSettings? settings,
  bool maintainState = true,
  bool fullscreenDialog = false,
  bool nonOpaque = true,
  bool forceMaterial = false,
  bool inPageRoute = false,
}) {
  if (inPageRoute == true) {
    return PageRouteBuilder<T>(
      pageBuilder: (BuildContext context, Animation<double> animation,
          Animation<double> secondaryAnimation) {
        return builder!(context);
      },
      settings: settings,
      maintainState: maintainState,
    );
  } else if (infoX.isIOS && nonOpaque) {
    return NonOpaqueCupertinoPageRoute<T>(
        builder: builder!,
        settings: settings,
        maintainState: maintainState,
        fullscreenDialog: fullscreenDialog);
  } else if (infoX.isIOS && !forceMaterial) {
    return CupertinoPageRoute<T>(
        builder: builder!,
        settings: settings,
        maintainState: maintainState,
        fullscreenDialog: fullscreenDialog);
  } else if (infoX.isMacOS) {
    return PageRouteBuilder(
      settings: settings,
      transitionsBuilder: (context, a1, a2, page) {
        var curveTween = CurveTween(curve: Curves.easeIn);
        return FadeTransition(
            opacity: a1.drive(curveTween),
            child: page);
      },
      pageBuilder: (context, animation, animation2) => Builder(builder: builder!),
    );
  } else {
    return MaterialPageRoute<T>(
      builder: builder!,
      settings: settings,
      maintainState: maintainState,
      fullscreenDialog: fullscreenDialog,
    );
  }
}