Router<T> constructor

const Router<T>({
  1. Key? key,
  2. RouteInformationProvider? routeInformationProvider,
  3. RouteInformationParser<T>? routeInformationParser,
  4. required RouterDelegate<T> routerDelegate,
  5. BackButtonDispatcher? backButtonDispatcher,
  6. String? restorationScopeId,
})

Creates a router.

The routeInformationProvider and routeInformationParser can be null if this router does not depend on route information. A common example is a sub router that builds its content completely based on the app state.

The routeInformationProvider and routeInformationParser must both be provided or not provided.

Implementation

const Router({
  super.key,
  this.routeInformationProvider,
  this.routeInformationParser,
  required this.routerDelegate,
  this.backButtonDispatcher,
  this.restorationScopeId,
}) : assert(
       routeInformationProvider == null || routeInformationParser != null,
       'A routeInformationParser must be provided when a routeInformationProvider is specified.',
     );