lowerCaseFirstChar method

  1. @useResult
String lowerCaseFirstChar()

Converts the first character (grapheme cluster) of the string to lowercase, leaving the rest of the string unchanged.

If the string is empty, it returns an empty string. The first character is a whole grapheme cluster, so a leading emoji or a letter followed by a combining mark (e.g. 'E' + U+0301) is kept intact.

Returns: A new string with the first character in lowercase, or an empty string if the original string is empty.

Example:

'MixedCase'.lowerCaseFirstChar(); // Returns 'mixedCase'
'lowercase'.lowerCaseFirstChar(); // Returns 'lowercase'
'👋Ab'.lowerCaseFirstChar();      // Returns '👋Ab'
''.lowerCaseFirstChar();        // Returns ''

Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
String lowerCaseFirstChar() {
  if (isEmpty) return '';
  // Grapheme-safe split (see _splitFirstGrapheme) instead of this[0].
  final (String first, String rest) = _splitFirstGrapheme(this);

  return first.toLowerCase() + rest;
}