RtGetMaterialApp.router constructor

RtGetMaterialApp.router(
  1. bool? enableDeepLink,
  2. dynamic handleDeepLink(
    1. Uri
    )?, {
  3. Key? key,
  4. RouteInformationProvider? routeInformationProvider,
  5. GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  6. RouteInformationParser<Object>? routeInformationParser,
  7. RouterDelegate<Object>? routerDelegate,
  8. BackButtonDispatcher? backButtonDispatcher,
  9. TransitionBuilder? builder,
  10. String title = '',
  11. GenerateAppTitle? onGenerateTitle,
  12. Color? color,
  13. ThemeData? theme,
  14. ThemeData? darkTheme,
  15. bool useInheritedMediaQuery = false,
  16. ThemeData? highContrastTheme,
  17. ThemeData? highContrastDarkTheme,
  18. ThemeMode themeMode = ThemeMode.system,
  19. Locale? locale,
  20. Iterable<LocalizationsDelegate>? localizationsDelegates,
  21. LocaleListResolutionCallback? localeListResolutionCallback,
  22. LocaleResolutionCallback? localeResolutionCallback,
  23. Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')],
  24. bool debugShowMaterialGrid = false,
  25. bool showPerformanceOverlay = false,
  26. bool checkerboardRasterCacheImages = false,
  27. bool checkerboardOffscreenLayers = false,
  28. bool showSemanticsDebugger = false,
  29. bool debugShowCheckedModeBanner = true,
  30. Map<LogicalKeySet, Intent>? shortcuts,
  31. ScrollBehavior? scrollBehavior,
  32. Map<Type, Action<Intent>>? actions,
  33. CustomTransition? customTransition,
  34. Map<String, Map<String, String>>? translationsKeys,
  35. Translations? translations,
  36. TextDirection? textDirection,
  37. Locale? fallbackLocale,
  38. ValueChanged<Routing?>? routingCallback,
  39. Transition? defaultTransition,
  40. bool? opaqueRoute,
  41. VoidCallback? onInit,
  42. VoidCallback? onReady,
  43. VoidCallback? onDispose,
  44. bool? enableLog = kDebugMode,
  45. LogWriterCallback? logWriterCallback,
  46. bool? popGesture,
  47. SmartManagement smartManagement = SmartManagement.full,
  48. Bindings? initialBinding,
  49. Duration? transitionDuration,
  50. bool? defaultGlobalState,
  51. List<GetPage>? getPages,
  52. List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  53. GetPage? unknownRoute,
})

Creates an RtGetMaterialApp with router-based navigation.

This constructor uses the new Flutter Navigator 2.0 API with RouterDelegate and RouteInformationParser for declarative routing. Deep link handling is still supported via platform message interception.

Parameters:

  • enableDeepLink: Enable deep link handling
  • handleDeepLink: Callback to handle intercepted URIs
  • routeInformationProvider: Provides route information updates
  • routeInformationParser: Parses route strings to typed objects
  • routerDelegate: Builds navigator based on current route state
  • All other parameters inherited from GetMaterialApp.router

Example:

RtGetMaterialApp.router(
  true, // enableDeepLink
  (uri) => MyApp.handleDeepLink(uri),
  routerDelegate: myDelegate,
  routeInformationParser: myParser,
);

Implementation

RtGetMaterialApp.router(
  this.enableDeepLink,
  this.handleDeepLink, {
  super.key,
  this.routeInformationProvider,
  super.scaffoldMessengerKey,
  RouteInformationParser<Object>? routeInformationParser,
  RouterDelegate<Object>? routerDelegate,
  this.backButtonDispatcher,
  super.builder,
  super.title = '',
  super.onGenerateTitle,
  super.color,
  super.theme,
  super.darkTheme,
  super.useInheritedMediaQuery = false,
  super.highContrastTheme,
  super.highContrastDarkTheme,
  super.themeMode = ThemeMode.system,
  super.locale,
  super.localizationsDelegates,
  super.localeListResolutionCallback,
  super.localeResolutionCallback,
  super.supportedLocales = const <Locale>[Locale('en', 'US')],
  super.debugShowMaterialGrid = false,
  super.showPerformanceOverlay = false,
  super.checkerboardRasterCacheImages = false,
  super.checkerboardOffscreenLayers = false,
  super.showSemanticsDebugger = false,
  super.debugShowCheckedModeBanner = true,
  super.shortcuts,
  super.scrollBehavior,
  super.actions,
  super.customTransition,
  super.translationsKeys,
  super.translations,
  super.textDirection,
  super.fallbackLocale,
  super.routingCallback,
  super.defaultTransition,
  super.opaqueRoute,
  super.onInit,
  super.onReady,
  super.onDispose,
  super.enableLog = kDebugMode,
  super.logWriterCallback,
  super.popGesture,
  super.smartManagement = SmartManagement.full,
  super.initialBinding,
  super.transitionDuration,
  super.defaultGlobalState,
  super.getPages,
  super.navigatorObservers,
  super.unknownRoute,
})  : routerDelegate = routerDelegate ??= Get.createDelegate(
        notFoundRoute: unknownRoute,
      ),
      routeInformationParser =
          routeInformationParser ??= Get.createInformationParser(
        initialRoute: getPages?.first.name ?? '/',
      ),
      //navigatorObservers = null,
      navigatorKey = null,
      onGenerateRoute = null,
      home = null,
      onGenerateInitialRoutes = null,
      onUnknownRoute = null,
      routes = null,
      initialRoute = null {
  // Set GetX global router configuration
  Get.routerDelegate = routerDelegate;
  Get.routeInformationParser = routeInformationParser;
}