toCamelCase method
Implementation
String toCamelCase({String? splitter = "_"}) {
var chars = split("");
var formatted = "";
for (int i = 0; i < chars.length; i++) {
if (chars[i] == splitter && (i) < chars.length - 1) {
chars[i + 1] = chars[i + 1].toUpperCase();
chars.removeAt(i);
}
}
for (var element in chars) {
formatted += element;
}
if (formatted.endsWith(splitter!) && formatted.isNotEmpty) {
return formatted
.substring(0, formatted.length - 1)
.toCamelCase(splitter: splitter);
}
return formatted;
}