camelCase property

String get camelCase

Converts the string to camelCase.

Example:

'hello_world case'.camelCase; // 'helloWorldCase'

Implementation

String get camelCase {
  final words = split(RegExp(r'\s+|_+'));
  if (words.isEmpty) return '';
  return words[0].toLowerCase() +
      words
          .skip(1)
          .map(
            (w) => w.isEmpty ? '' : '${w[0].toUpperCase()}${w.substring(1)}',
          )
          .join('');
}