toCamelCase static method
Implementation
static String toCamelCase(String input) {
// Split the input string by spaces, hyphens, or underscores
List<String> words = input.split(RegExp(r'[\s_-]+'));
// Convert the first word to lowercase and capitalize the first letter of the subsequent words
String camelCaseString = words.map((word) {
if (words.indexOf(word) == 0) {
return word.toLowerCase();
} else {
return word[0].toUpperCase() + word.substring(1).toLowerCase();
}
}).join('');
return camelCaseString;
}