splitByAsciiWhitespace function
Implementation
List<String> splitByAsciiWhitespace(String input) {
final int len = input.length;
if (len == 0) return const <String>[];
final List<String> out = <String>[];
int i = 0;
while (i < len && isAsciiWhitespaceCodeUnit(input.codeUnitAt(i))) {
i++;
}
if (i >= len) return const <String>[];
int start = i;
while (i < len) {
final int cu = input.codeUnitAt(i);
if (isAsciiWhitespaceCodeUnit(cu)) {
if (start < i) out.add(input.substring(start, i));
while (i < len && isAsciiWhitespaceCodeUnit(input.codeUnitAt(i))) {
i++;
}
start = i;
continue;
}
i++;
}
if (start < len) out.add(input.substring(start));
return out;
}