createRouter function

Unrouter createRouter({
  1. required Iterable<Inlet> routes,
  2. Iterable<Guard>? guards,
  3. String base = '/',
  4. int maxRedirectDepth = 8,
  5. History? history,
  6. HistoryStrategy strategy = HistoryStrategy.browser,
})

Creates a Flutter router backed by core.createRouter.

Implementation

Unrouter createRouter({
  required Iterable<Inlet> routes,
  Iterable<core.Guard>? guards,
  String base = '/',
  int maxRedirectDepth = 8,
  History? history,
  HistoryStrategy strategy = HistoryStrategy.browser,
}) {
  return core.createRouter<Widget>(
    routes: routes,
    guards: guards,
    base: base,
    maxRedirectDepth: maxRedirectDepth,
    history: history,
    strategy: strategy,
    errorReporter: (error, stackTrace) {
      FlutterError.reportError(
        FlutterErrorDetails(
          exception: error,
          stack: stackTrace,
          context: ErrorDescription('while processing history pop event'),
        ),
      );
    },
  );
}