words static method
Limits value to a number of words.
Implementation
static String words(String value, [int words = 100, String end = '...']) {
final match = RegExp(
r'^\s*(?:\S+\s*){1,' + words.toString() + r'}',
).firstMatch(value);
if (match == null || match.group(0)!.length >= value.length) return value;
return '${match.group(0)!.trimRight()}$end';
}