camelCase method

String camelCase({
  1. bool preserveAcronym = false,
})

Changes a string into camelCase

To prevent acronyms from being converted to upper or lowercase, preserveAcronym can be set to true.

Implementation

String camelCase({bool preserveAcronym = false}) => this
    .words()
    .mapIndex(
      (word, index) => index == 0
          ? (preserveAcronym)
              ? (word!.isUpperCase() ? word : word.lowerCase())
              : word!.lowerCase()
          : word!.capitalize(capitalizeAll: false),
    )
    .toList()
    .join();