substr function
Implementation
String substr(String str, int start, [int? length]) {
if (start < 0) {
start = str.length + start;
}
if (start < 0) {
start = 0;
}
if (start > str.length) {
start = str.length;
}
var end = length == null
? str.length
: start + length > str.length
? str.length
: start + length;
return str.substring(start, end);
}