capitalizeAndLowercase method

String capitalizeAndLowercase()

Capitalize the first character of the string and lowercase the others (using toUpperCase() and toLowerCase() respectively).

Implementation

String capitalizeAndLowercase() => [
      if (isNotEmpty) this[0].toUpperCase(),
      if (length > 1) substring(1, length).toLowerCase()
    ].join();