splitByIndices function
Splits a string at the indices passed in
Implementation
List<String> splitByIndices(String source, List<int> positions) {
if (positions.length == 0) return [source];
if (positions[0] != 0) positions.insert(0, 0);
if (positions[positions.length - 1] != source.length) positions.insert(positions.length, source.length);
List<String> x1 = [];
for (var i = 0; i < positions.length - 1; i++) {
x1.add(source.substring(positions[i], positions[i + 1]));
}
return x1;
}