splitLiteralPercentS function
input text turns %s into a space, so text is split between % and s to keep a literal %s.
Implementation
List<String> splitLiteralPercentS(String text) {
final chunks = <String>[];
var start = 0;
for (var i = 0; i < text.length - 1; i++) {
if (text[i] == '%' && text[i + 1] == 's') {
chunks.add(text.substring(start, i + 1));
start = i + 1;
}
}
chunks.add(text.substring(start));
return chunks.where((c) => c.isNotEmpty).toList();
}