allMatches method Null safety

  1. @override
Iterable<Match> allMatches(
  1. String path,
  2. [int start = 0]
)
override

Matches this pattern against the string repeatedly.

If start is provided, matching will start at that index.

The returned iterable lazily finds non-overlapping matches of the pattern in the string. If a user only requests the first match, this function should not compute all possible matches.

The matches are found by repeatedly finding the first match of the pattern in the string, initially starting from start, and then from the end of the previous match (but always at least one position later than the start of the previous match, in case the patter matches an empty substring).

Implementation

@override
Iterable<Match> allMatches(String path, [int start = 0]) {
  var match = matchAsPrefix(path, start);
  return match == null ? [] : [match];
}