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