onGenerateRoute method

Route? onGenerateRoute(
  1. RouteSettings settings, [
  2. String? basePath
])
inherited

Implementation

Route<dynamic>? onGenerateRoute(RouteSettings settings, [String? basePath]) {
  var match = findMatch(settings);
  if (match != null) {
    if (basePath != null) {
      match = match.copyWith(name: _joinPath(basePath, match.name))
          as RouteMatchV1?;
    }

    RouteDataV1 data;
    if (match!.isParent) {
      data = ParentRouteData(
        matchResult: match,
        initialRoute: match.rest,
        router: match.routeDef.generator,
      );
    } else {
      data = RouteDataV1(match);
    }
    return pagesMap[match.routeDef.page!]!(data);
  }
  return null;
}