toCamelCase property

String get toCamelCase

Converts a string to camelCase.

Example:

'hello world'.toCamelCase(); // Output: 'helloWorld'

Implementation

String get toCamelCase {
  final words = trim().split(RegExp(r'\s+'));
  if (words.isEmpty) return '';
  return words.first.toLowerCase() +
      words.skip(1).map((w) => w.capitalizeFirst).join();
}