import 'package:cake_wallet/anonpay/anonpay_info_base.dart'; import 'package:cake_wallet/anonpay/anonpay_invoice_info.dart'; import 'package:cake_wallet/buy/order.dart'; import 'package:cake_wallet/core/totp_request_details.dart'; import 'package:cake_wallet/core/wallet_connect/web3wallet_service.dart'; import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/entities/qr_view_data.dart'; import 'package:cake_wallet/entities/wallet_nft_response.dart'; import 'package:cake_wallet/exchange/trade.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/anonpay_details/anonpay_details_page.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/src/screens/backup/backup_page.dart'; import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart'; import 'package:cake_wallet/src/screens/buy/buy_options_page.dart'; import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart'; import 'package:cake_wallet/src/screens/buy/webview_page.dart'; import 'package:cake_wallet/src/screens/connect_device/connect_device_page.dart'; import 'package:cake_wallet/src/screens/connect_device/select_hardware_wallet_account_page.dart'; import 'package:cake_wallet/src/screens/contact/contact_list_page.dart'; import 'package:cake_wallet/src/screens/contact/contact_page.dart'; import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_actions.dart'; import 'package:cake_wallet/src/screens/dashboard/edit_token_page.dart'; import 'package:cake_wallet/src/screens/dashboard/home_settings_page.dart'; import 'package:cake_wallet/src/screens/dashboard/pages/address_page.dart'; import 'package:cake_wallet/src/screens/dashboard/pages/nft_details_page.dart'; import 'package:cake_wallet/src/screens/dashboard/pages/transactions_page.dart'; import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart'; import 'package:cake_wallet/src/screens/faq/faq_page.dart'; import 'package:cake_wallet/src/screens/monero_accounts/monero_account_edit_or_create_page.dart'; import 'package:cake_wallet/src/screens/nano/nano_change_rep_page.dart'; import 'package:cake_wallet/src/screens/nano_accounts/nano_account_edit_or_create_page.dart'; import 'package:cake_wallet/src/screens/new_wallet/advanced_privacy_settings_page.dart'; import 'package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart'; import 'package:cake_wallet/src/screens/new_wallet/new_wallet_type_page.dart'; import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart'; import 'package:cake_wallet/src/screens/nodes/pow_node_create_or_edit_page.dart'; import 'package:cake_wallet/src/screens/order_details/order_details_page.dart'; import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:cake_wallet/src/screens/receive/anonpay_invoice_page.dart'; import 'package:cake_wallet/src/screens/receive/anonpay_receive_page.dart'; import 'package:cake_wallet/src/screens/receive/fullscreen_qr_page.dart'; import 'package:cake_wallet/src/screens/receive/receive_page.dart'; import 'package:cake_wallet/src/screens/rescan/rescan_page.dart'; import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart'; import 'package:cake_wallet/src/screens/restore/restore_options_page.dart'; import 'package:cake_wallet/src/screens/restore/sweeping_wallet_page.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_choose_derivation.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart'; import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart'; import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart'; import 'package:cake_wallet/src/screens/send/send_page.dart'; import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/connection_sync_page.dart'; import 'package:cake_wallet/src/screens/settings/desktop_settings/desktop_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/display_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/domain_lookups_page.dart'; import 'package:cake_wallet/src/screens/settings/manage_nodes_page.dart'; import 'package:cake_wallet/src/screens/settings/mweb_settings.dart'; import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; import 'package:cake_wallet/src/screens/settings/security_backup_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/auth/cake_pay_account_page.dart'; import 'package:cake_wallet/src/screens/settings/silent_payments_settings.dart'; import 'package:cake_wallet/src/screens/settings/tor_page.dart'; import 'package:cake_wallet/src/screens/settings/trocador_providers_page.dart'; import 'package:cake_wallet/src/screens/settings/tor_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/modify_2fa_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_enter_code_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_info_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_qr_page.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart'; import 'package:cake_wallet/src/screens/support/support_page.dart'; import 'package:cake_wallet/src/screens/support_chat/support_chat_page.dart'; import 'package:cake_wallet/src/screens/support_other_links/support_other_links_page.dart'; import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart'; import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart'; import 'package:cake_wallet/src/screens/transaction_details/rbf_details_page.dart'; import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart'; import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart'; import 'package:cake_wallet/src/screens/wallet/wallet_edit_page.dart'; import 'package:cake_wallet/src/screens/wallet_connect/wc_connections_listing_view.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart'; import 'package:cake_wallet/src/screens/welcome/create_welcome_page.dart'; import 'package:cake_wallet/utils/payment_request.dart'; import 'package:cake_wallet/view_model/advanced_privacy_settings_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart'; import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart'; import 'package:cake_wallet/view_model/seed_type_view_model.dart'; import 'package:cake_wallet/view_model/wallet_hardware_restore_view_model.dart'; import 'package:cake_wallet/view_model/wallet_new_vm.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cake_wallet/wallet_types.g.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/nano_account.dart'; import 'package:cw_core/node.dart'; import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:cake_wallet/src/screens/cake_pay/cake_pay.dart'; import 'src/screens/dashboard/pages/nft_import_page.dart'; late RouteSettings currentRouteSettings; Route createRoute(RouteSettings settings) { currentRouteSettings = settings; switch (settings.name) { case Routes.welcome: return MaterialPageRoute(builder: (_) => createWelcomePage()); case Routes.newWalletFromWelcome: return CupertinoPageRoute( builder: (_) => getIt.get(param1: (PinCodeState context, dynamic _) { if (availableWalletTypes.length == 1) { Navigator.of(context.context) .pushNamed(Routes.newWallet, arguments: availableWalletTypes.first); } else { Navigator.of(context.context).pushNamed(Routes.newWalletType); } }), fullscreenDialog: true); case Routes.newWalletType: return CupertinoPageRoute( builder: (_) => getIt.get( param1: (BuildContext context, WalletType type) => Navigator.of(context).pushNamed(Routes.newWallet, arguments: type))); case Routes.newWallet: final type = settings.arguments as WalletType; final walletNewVM = getIt.get(param1: type); final seedTypeViewModel = getIt.get(); return CupertinoPageRoute( builder: (_) => NewWalletPage(walletNewVM, seedTypeViewModel)); case Routes.chooseHardwareWalletAccount: final arguments = settings.arguments as List; final type = arguments[0] as WalletType; final walletVM = getIt.get(param1: type); return CupertinoPageRoute(builder: (_) => SelectHardwareWalletAccountPage(walletVM)); case Routes.setupPin: Function(PinCodeState, String)? callback; if (settings.arguments is Function(PinCodeState, String)) { callback = settings.arguments as Function(PinCodeState, String); } return CupertinoPageRoute( builder: (_) => getIt.get(param1: callback)); case Routes.restoreWalletType: return CupertinoPageRoute( builder: (_) => getIt.get( param1: (BuildContext context, WalletType type) => Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type), param2: [false, false])); case Routes.restoreOptions: final isNewInstall = settings.arguments as bool; return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: isNewInstall)); case Routes.restoreWalletFromSeedKeys: final isNewInstall = settings.arguments as bool; if (isNewInstall) { return CupertinoPageRoute( builder: (_) => getIt.get( param1: (PinCodeState context, dynamic _) { if (isSingleCoin) { return Navigator.of(context.context) .pushNamed(Routes.restoreWallet, arguments: availableWalletTypes.first); } return Navigator.pushNamed(context.context, Routes.restoreWalletType); }), fullscreenDialog: true); } else if (isSingleCoin) { return MaterialPageRoute( builder: (_) => getIt.get(param1: availableWalletTypes.first)); } else { return CupertinoPageRoute( builder: (_) => getIt.get( param1: (BuildContext context, WalletType type) => Navigator.of(context).pushNamed(Routes.restoreWallet, arguments: type), param2: [false, false])); } case Routes.restoreWalletFromHardwareWallet: final isNewInstall = settings.arguments as bool; if (isNewInstall) { return CupertinoPageRoute( builder: (_) => getIt.get( param1: (PinCodeState context, dynamic _) => Navigator.of(context.context) .pushNamed(Routes.restoreWalletFromHardwareWallet, arguments: false), ), fullscreenDialog: true, ); } if (isSingleCoin) { return MaterialPageRoute( builder: (_) => ConnectDevicePage( ConnectDevicePageParams( walletType: availableWalletTypes.first, onConnectDevice: (BuildContext context, _) => Navigator.of(context).pushNamed( Routes.chooseHardwareWalletAccount, arguments: [availableWalletTypes.first]), ), getIt.get(), )); } else { return CupertinoPageRoute( builder: (_) => getIt.get( param1: (BuildContext context, WalletType type) { final arguments = ConnectDevicePageParams( walletType: type, onConnectDevice: (BuildContext context, _) => Navigator.of(context) .pushNamed(Routes.chooseHardwareWalletAccount, arguments: [type]), ); Navigator.of(context).pushNamed(Routes.connectDevices, arguments: arguments); }, param2: [false, true])); } case Routes.restoreWalletTypeFromQR: return CupertinoPageRoute( builder: (_) => getIt.get( param1: (BuildContext context, WalletType type) => Navigator.of(context).pop(type))); case Routes.seed: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as bool)); case Routes.restoreWallet: return MaterialPageRoute( builder: (_) => getIt.get(param1: settings.arguments as WalletType)); case Routes.restoreWalletChooseDerivation: return MaterialPageRoute( builder: (_) => getIt.get( param1: settings.arguments as List)); case Routes.sweepingWalletPage: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.dashboard: return CupertinoPageRoute( settings: settings, builder: (_) => getIt.get()); case Routes.send: final initialPaymentRequest = settings.arguments as PaymentRequest?; return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get( param1: initialPaymentRequest, )); case Routes.sendTemplate: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.receive: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.addressPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.transactionDetails: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as TransactionInfo)); case Routes.bumpFeePage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as TransactionInfo)); case Routes.newSubaddress: return CupertinoPageRoute( builder: (_) => getIt.get(param1: settings.arguments)); case Routes.disclaimer: return CupertinoPageRoute(builder: (_) => DisclaimerPage()); case Routes.readDisclaimer: return CupertinoPageRoute(builder: (_) => DisclaimerPage(isReadOnly: true)); case Routes.changeRep: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.walletList: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.walletEdit: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as List)); case Routes.auth: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get( param1: settings.arguments as OnAuthenticationFinished, param2: true)); case Routes.totpAuthCodePage: final args = settings.arguments as TotpAuthArgumentsModel; return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get( param1: args, ), ); case Routes.login: return CupertinoPageRoute( builder: (context) => WillPopScope( child: getIt.get(instanceName: 'login'), onWillPop: () async => // FIX-ME: Additional check does it works correctly (await SystemChannels.platform.invokeMethod('SystemNavigator.pop') ?? false), ), fullscreenDialog: true); case Routes.unlock: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => WillPopScope( child: getIt.get( param1: settings.arguments as OnAuthenticationFinished, param2: false), onWillPop: () async => false)); case Routes.silentPaymentsSettings: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.mwebSettings: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.connectionSync: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.securityBackupPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.privacyPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.trocadorProvidersPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.domainLookupsPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.displaySettingsPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.otherSettingsPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.newNode: final args = settings.arguments as Map?; return CupertinoPageRoute( builder: (_) => getIt.get( param1: args?['editingNode'] as Node?, param2: args?['isSelected'] as bool?)); case Routes.newPowNode: final args = settings.arguments as Map?; return CupertinoPageRoute( builder: (_) => getIt.get( param1: args?['editingNode'] as Node?, param2: args?['isSelected'] as bool?)); case Routes.accountCreation: return CupertinoPageRoute( builder: (_) => getIt.get( param1: settings.arguments as AccountListItem?)); case Routes.nanoAccountCreation: return CupertinoPageRoute( builder: (_) => getIt.get(param1: settings.arguments as NanoAccount?)); case Routes.addressBook: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.pickerAddressBook: final selectedCurrency = settings.arguments as CryptoCurrency?; return MaterialPageRoute( builder: (_) => getIt.get(param1: selectedCurrency)); case Routes.addressBookAddContact: return CupertinoPageRoute( builder: (_) => getIt.get(param1: settings.arguments as ContactRecord?)); case Routes.showKeys: return MaterialPageRoute( builder: (_) => getIt.get(), fullscreenDialog: true); case Routes.exchangeTrade: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.exchangeConfirm: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.tradeDetails: return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as Trade)); case Routes.orderDetails: return MaterialPageRoute( builder: (_) => getIt.get(param1: settings.arguments as Order)); case Routes.buySellPage: final args = settings.arguments as bool; return MaterialPageRoute(builder: (_) => getIt.get(param1: args)); case Routes.buyWebView: final args = settings.arguments as List; return MaterialPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: args)); case Routes.exchange: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get(param1: settings.arguments as PaymentRequest?), ); case Routes.exchangeTemplate: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.rescan: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.faq: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.preSeedPage: return MaterialPageRoute( builder: (_) => getIt.get(param1: settings.arguments as int)); case Routes.backup: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.editBackupPassword: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.restoreFromBackup: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.support: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.supportLiveChat: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.supportOtherLinks: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.unspentCoinsList: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.unspentCoinsDetails: final args = settings.arguments as List; return MaterialPageRoute( builder: (_) => getIt.get(param1: args)); case Routes.fullscreenQR: return MaterialPageRoute( builder: (_) => getIt.get( param1: settings.arguments as QrViewData, )); case Routes.cakePayCardsPage: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.cakePayBuyCardPage: final args = settings.arguments as List; return CupertinoPageRoute( builder: (_) => getIt.get(param1: args)); case Routes.cakePayBuyCardDetailPage: final args = settings.arguments as List; return CupertinoPageRoute( builder: (_) => getIt.get(param1: args)); case Routes.cakePayWelcomePage: return CupertinoPageRoute( builder: (_) => getIt.get(), ); case Routes.cakePayVerifyOtpPage: final args = settings.arguments as List; return CupertinoPageRoute(builder: (_) => getIt.get(param1: args)); case Routes.cakePayAccountPage: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.webViewPage: final args = settings.arguments as List; final title = args.first as String; final url = args[1] as Uri; return CupertinoPageRoute( builder: (_) => getIt.get(param1: title, param2: url)); case Routes.advancedPrivacySettings: final args = settings.arguments as Map; final type = args['type'] as WalletType; final useTestnet = args['useTestnet'] as bool; final toggleTestnet = args['toggleTestnet'] as Function(bool? val); return CupertinoPageRoute( builder: (_) => AdvancedPrivacySettingsPage( useTestnet, toggleTestnet, getIt.get(param1: type), getIt.get(param1: type, param2: false), getIt.get(), )); case Routes.anonPayInvoicePage: final args = settings.arguments as List; return CupertinoPageRoute(builder: (_) => getIt.get(param1: args)); case Routes.anonPayReceivePage: final anonInvoiceViewData = settings.arguments as AnonpayInfoBase; return CupertinoPageRoute( builder: (_) => getIt.get(param1: anonInvoiceViewData)); case Routes.anonPayDetailsPage: final anonInvoiceViewData = settings.arguments as AnonpayInvoiceInfo; return CupertinoPageRoute( builder: (_) => getIt.get(param1: anonInvoiceViewData)); case Routes.desktop_actions: return PageRouteBuilder( opaque: false, pageBuilder: (_, __, ___) => DesktopDashboardActions(getIt()), ); case Routes.desktop_settings_page: return CupertinoPageRoute(builder: (_) => getIt.get()); case Routes.empty_no_route: return MaterialPageRoute(builder: (_) => SizedBox.shrink()); case Routes.transactionsPage: return CupertinoPageRoute( settings: settings, fullscreenDialog: true, builder: (_) => getIt.get()); case Routes.setup_2faPage: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.setup_2faQRPage: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.modify2FAPage: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.setup2faInfoPage: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.homeSettings: return CupertinoPageRoute( builder: (_) => getIt.get(param1: settings.arguments), ); case Routes.editToken: final args = settings.arguments as Map; return CupertinoPageRoute( settings: RouteSettings(name: Routes.editToken), builder: (_) => getIt.get( param1: args['homeSettingsViewModel'], param2: { 'token': args['token'], 'contractAddress': args['contractAddress'], }, ), ); case Routes.manageNodes: return MaterialPageRoute(builder: (_) => getIt.get(param1: false)); case Routes.managePowNodes: return MaterialPageRoute(builder: (_) => getIt.get(param1: true)); case Routes.walletConnectConnectionsListing: return MaterialPageRoute( builder: (_) => WalletConnectConnectionsView( web3walletService: getIt.get(), launchUri: settings.arguments as Uri?, )); case Routes.nftDetailsPage: return MaterialPageRoute( builder: (_) => NFTDetailsPage( nftAsset: settings.arguments as NFTAssetModel, dashboardViewModel: getIt.get(), ), ); case Routes.importNFTPage: return MaterialPageRoute( builder: (_) => ImportNFTPage( nftViewModel: settings.arguments as NFTViewModel, ), ); case Routes.torPage: return MaterialPageRoute(builder: (_) => getIt.get()); case Routes.connectDevices: final params = settings.arguments as ConnectDevicePageParams; return MaterialPageRoute( builder: (_) => ConnectDevicePage(params, getIt.get())); default: return MaterialPageRoute( builder: (_) => Scaffold( body: Center(child: Text(S.current.router_no_route(settings.name ?? 'No route'))))); } }