firstWord method

  1. @useResult
String? firstWord()

Returns the first word of this string, or null if empty.

Implementation

@useResult
String? firstWord() {
  if (isEmpty) {
    return null;
  }

  return words()?.firstOrNull;
}