matchSegments method

List<String>? matchSegments(
  1. String path
)

The param values when path matches this route, in the order of paramNames. Null when it does not match. Only for a route with hasSegments: for other routes it gives null.

Implementation

List<String>? matchSegments(String path) {
  List<String>? values = _matchParts(path);
  if (values != null || !_dotted) return values;
  // a `.` of the regex matches a `/` too, so a url that the parts miss
  // may still match the regex. Rare: only a miss pays for it.
  RegExpMatch? match = _pattern!.firstMatch(path);
  if (match == null) return null;
  return <String>[
    for (int i = 1; i <= match.groupCount; i++) match.group(i) ?? '',
  ];
}