words method
Returns this string split into a list of words, or null if empty.
Uses space as the delimiter and filters out empty words. Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
List<String>? words() {
if (isEmpty) {
return null;
}
return split(
' ',
).map((String word) => word.nullIfEmpty()).whereType<String>().toList().nullIfEmpty();
}