match static method

List<RouteMatchBase> match({
  1. required RouteBase route,
  2. required Map<String, String> pathParameters,
  3. required GlobalKey<NavigatorState> rootNavigatorKey,
  4. required Uri uri,
})

Generates a list of RouteMatchBase objects by matching the route and its sub-routes with uri.

This method returns empty list if it can't find a complete match in the route.

The rootNavigatorKey is required to match routes with parentNavigatorKey.

The extracted path parameters, as the result of the matching, are stored into pathParameters.

Implementation

static List<RouteMatchBase> match({
  required RouteBase route,
  required Map<String, String> pathParameters,
  required GlobalKey<NavigatorState> rootNavigatorKey,
  required Uri uri,
}) {
  return _matchByNavigatorKey(
        route: route,
        matchedPath: '',
        remainingLocation: uri.path,
        matchedLocation: '',
        pathParameters: pathParameters,
        scopedNavigatorKey: rootNavigatorKey,
        uri: uri,
      )[null] ??
      const <RouteMatchBase>[];
}