RtGetMaterialApp.router constructor
RtGetMaterialApp.router(
- bool? enableDeepLink,
- dynamic handleDeepLink()?, {
- Key? key,
- RouteInformationProvider? routeInformationProvider,
- GlobalKey<
ScaffoldMessengerState> ? scaffoldMessengerKey, - RouteInformationParser<
Object> ? routeInformationParser, - RouterDelegate<
Object> ? routerDelegate, - BackButtonDispatcher? backButtonDispatcher,
- TransitionBuilder? builder,
- String title = '',
- GenerateAppTitle? onGenerateTitle,
- Color? color,
- ThemeData? theme,
- ThemeData? darkTheme,
- bool useInheritedMediaQuery = false,
- ThemeData? highContrastTheme,
- ThemeData? highContrastDarkTheme,
- ThemeMode themeMode = ThemeMode.system,
- Locale? locale,
- Iterable<
LocalizationsDelegate> ? localizationsDelegates, - LocaleListResolutionCallback? localeListResolutionCallback,
- LocaleResolutionCallback? localeResolutionCallback,
- Iterable<
Locale> supportedLocales = const <Locale>[Locale('en', 'US')], - bool debugShowMaterialGrid = false,
- bool showPerformanceOverlay = false,
- bool checkerboardRasterCacheImages = false,
- bool checkerboardOffscreenLayers = false,
- bool showSemanticsDebugger = false,
- bool debugShowCheckedModeBanner = true,
- Map<
LogicalKeySet, Intent> ? shortcuts, - ScrollBehavior? scrollBehavior,
- Map<
Type, Action< ? actions,Intent> > - CustomTransition? customTransition,
- Map<
String, Map< ? translationsKeys,String, String> > - Translations? translations,
- TextDirection? textDirection,
- Locale? fallbackLocale,
- ValueChanged<
Routing?> ? routingCallback, - Transition? defaultTransition,
- bool? opaqueRoute,
- VoidCallback? onInit,
- VoidCallback? onReady,
- VoidCallback? onDispose,
- bool? enableLog = kDebugMode,
- LogWriterCallback? logWriterCallback,
- bool? popGesture,
- SmartManagement smartManagement = SmartManagement.full,
- Bindings? initialBinding,
- Duration? transitionDuration,
- bool? defaultGlobalState,
- List<
GetPage> ? getPages, - 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 handlinghandleDeepLink: Callback to handle intercepted URIsrouteInformationProvider: Provides route information updatesrouteInformationParser: Parses route strings to typed objectsrouterDelegate: 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;
}