toLowerCamelCase function

String toLowerCamelCase(
  1. String text
)

Converts strings to Lower Camel Case.

Implementation

String toLowerCamelCase(String text) {
  final RegExp separatorPattern = RegExp(r'[ _-]');
  bool firstWord = true;
  return text.split(separatorPattern).map((String word) {
    if (word.isEmpty) {
      return '';
    }
    if (firstWord) {
      firstWord = false;
      return word.substring(0, 1).toLowerCase() + word.substring(1);
    }
    return word.substring(0, 1).toUpperCase() + word.substring(1);
  }).join();
}