onGenerateRoute static method

Route? onGenerateRoute(
  1. RouteSettings routeSettings
)

Implementation

static Route? onGenerateRoute(RouteSettings routeSettings) {
  switch (routeSettings.name) {
    case AddCardScreen.id:
      return MaterialPageRoute(builder: (_) => const AddCardScreen());
    case PaymentWebViewScreen.id:
      final PayResponseModel payResponseModel =
          routeSettings.arguments == null
              ? throw 'Need PayResponseModel'
              : (routeSettings.arguments! as PayResponseModel);
      return MaterialPageRoute(
          builder: (_) => PaymentWebViewScreen(
                payResponseModel: payResponseModel,
              ));
    case SavedCardsScreen.id:
      return MaterialPageRoute(builder: (_) => const SavedCardsScreen());

    default:
      return null;
  }
}