split method
Split string by the occurrences of pattern.
Implementation
List<String> split(String text) {
var result = <String>[];
var start = 0, end = 0;
for (var match in allMatches(text)) {
end = match.start;
if (start < end) {
result.add(text.substring(start, end));
}
for (var i = 0, count = match.groupCount; i < count; i++) {
result.add(match.group(i + 1)!);
}
start = match.end;
}
if (start < text.length) {
result.add(text.substring(start));
}
return result;
}