truncateToFixedWordLength method
String
truncateToFixedWordLength(
- int length, {
- String truncationIndicator = '…',
- TruncateAt truncateAt = TruncateAt.end,
- String? locale,
Truncates this String as necessary to ensure it contains at most length
words.
// 'Some text that is…'
'Some text that is too long'.truncateToFixedWordLength(4);
See also:
Implementation
String truncateToFixedWordLength(
int length, {
String truncationIndicator = '…',
TruncateAt truncateAt = TruncateAt.end,
String? locale,
}) =>
TruncateToFixedWordLengthTransformation(
length: length,
truncationIndicator: truncationIndicator,
truncateAt: truncateAt,
).transform(this, locale ?? Intl.getCurrentLocale());