replaceAll method Null safety

CharacterRange? replaceAll(
  1. Characters pattern,
  2. Characters replacement
)

Replaces pattern in the current range with replacement.

Replaces all occurrences of pattern in the current range with replacement, unless they overlap with an earlier occurrence of pattern which was replaced. Then returns a range on the resulting characters which contains all inserted replacement characters and any remaining characters of the original range.

The inserted characters may combine with the preceding or following code points, so that the start and end of the original range are no longer grapheme cluster boundaries. In that case, the returned range may extend into into the code points before and after the original range.

Returns null if there are no occurrences of pattern in the current range.

Implementation

CharacterRange? replaceAll(Characters pattern, Characters replacement);