WidgetsApp.router constructor

WidgetsApp.router({
  1. Key? key,
  2. RouteInformationProvider? routeInformationProvider,
  3. RouteInformationParser<Object>? routeInformationParser,
  4. RouterDelegate<Object>? routerDelegate,
  5. RouterConfig<Object>? routerConfig,
  6. BackButtonDispatcher? backButtonDispatcher,
  7. TransitionBuilder? builder,
  8. String title = '',
  9. GenerateAppTitle? onGenerateTitle,
  10. NotificationListenerCallback<NavigationNotification>? onNavigationNotification,
  11. TextStyle? textStyle,
  12. required Color color,
  13. Locale? locale,
  14. Iterable<LocalizationsDelegate>? localizationsDelegates,
  15. LocaleListResolutionCallback? localeListResolutionCallback,
  16. LocaleResolutionCallback? localeResolutionCallback,
  17. Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')],
  18. bool showPerformanceOverlay = false,
  19. bool showSemanticsDebugger = false,
  20. bool debugShowWidgetInspector = false,
  21. bool debugShowCheckedModeBanner = true,
  22. InspectorSelectButtonBuilder? inspectorSelectButtonBuilder,
  23. Map<ShortcutActivator, Intent>? shortcuts,
  24. Map<Type, Action<Intent>>? actions,
  25. String? restorationScopeId,
  26. @Deprecated('Remove this parameter as it is now ignored. ' 'WidgetsApp never introduces its own MediaQuery; the View widget takes care of that. ' 'This feature was deprecated after v3.7.0-29.0.pre.') bool useInheritedMediaQuery = false,
})

Creates a WidgetsApp that uses the Router instead of a Navigator.

If the routerConfig is provided, the other router related delegates, routeInformationParser, routeInformationProvider, routerDelegate, and backButtonDispatcher, must all be null.

Implementation

WidgetsApp.router({
  super.key,
  this.routeInformationProvider,
  this.routeInformationParser,
  this.routerDelegate,
  this.routerConfig,
  this.backButtonDispatcher,
  this.builder,
  this.title = '',
  this.onGenerateTitle,
  this.onNavigationNotification,
  this.textStyle,
  required this.color,
  this.locale,
  this.localizationsDelegates,
  this.localeListResolutionCallback,
  this.localeResolutionCallback,
  this.supportedLocales = const <Locale>[Locale('en', 'US')],
  this.showPerformanceOverlay = false,
  this.showSemanticsDebugger = false,
  this.debugShowWidgetInspector = false,
  this.debugShowCheckedModeBanner = true,
  this.inspectorSelectButtonBuilder,
  this.shortcuts,
  this.actions,
  this.restorationScopeId,
  @Deprecated(
    'Remove this parameter as it is now ignored. '
    'WidgetsApp never introduces its own MediaQuery; the View widget takes care of that. '
    'This feature was deprecated after v3.7.0-29.0.pre.'
  )
  this.useInheritedMediaQuery = false,
}) : assert((){
       if (routerConfig != null) {
         assert(
           (routeInformationProvider ?? routeInformationParser ?? routerDelegate ?? backButtonDispatcher) == null,
           'If the routerConfig is provided, all the other router delegates must not be provided',
         );
         return true;
       }
       assert(routerDelegate != null, 'Either one of routerDelegate or routerConfig must be provided');
       assert(
         routeInformationProvider == null || routeInformationParser != null,
         'If routeInformationProvider is provided, routeInformationParser must also be provided',
       );
       return true;
     }()),
     assert(supportedLocales.isNotEmpty),
     navigatorObservers = null,
     navigatorKey = null,
     onGenerateRoute = null,
     pageRouteBuilder = null,
     home = null,
     onGenerateInitialRoutes = null,
     onUnknownRoute = null,
     routes = null,
     initialRoute = null;