camelCase property

String get camelCase

Convert to camelCase

Implementation

String get camelCase {
  if (isEmpty) return this;
  final words = split(RegExp(r'[\s_-]+'));
  if (words.isEmpty) return this;

  return words.first.toLowerCase() +
      words
          .skip(1)
          .map((word) => word.isNotEmpty
              ? '${word[0].toUpperCase()}${word.substring(1).toLowerCase()}'
              : '')
          .join();
}