parse static method
Parses the given textValue
Implementation
static List<Uri> parse(final String textValue) {
final runes = textValue.runes.toList();
final result = <Uri>[];
var isInQuote = false;
var isLastBackslash = false;
var lastQuoteStart = 0;
for (var i = 0; i < runes.length; i++) {
final rune = runes[i];
if (isLastBackslash) {
// ignore this char
isLastBackslash = false;
} else {
if (rune == Rune.runeDoubleQuote) {
if (isInQuote) {
// this is the URI end
final uriText = textValue.substring(lastQuoteStart, i);
final uri = Uri.parse(uriText);
result.add(uri);
lastQuoteStart = i + 1;
isInQuote = false;
} else {
isInQuote = true;
lastQuoteStart = i;
}
} else if (rune == Rune.runeComma && !isInQuote) {
if (lastQuoteStart < i - 2) {
final uriText = textValue.substring(lastQuoteStart, i);
final uri = Uri.parse(uriText);
result.add(uri);
}
lastQuoteStart = i + 1;
} else if (rune == Rune.runeBackslash) {
isLastBackslash = true;
}
}
}
return result;
}