TruncateToFixedNonWhitespaceLengthTransformation class

A transformation to convert a String into a truncated variant that contains at most length non-whitespace characters.

If the input value exceeds length non-whitespace characters, it is truncated. If truncationIndicator does not exceed length characters, it is incorporated into the return value. The input will be truncated at either its start or end according to truncateAt.

final transformation = TruncateToFixedNonWhitespaceLengthTransformation(
  length: 12,
  truncationIndicator: '~',
  truncateAt: TruncateAt.end,
);

// 'A string that~'
transformation.transform('A string that is too long', 'en_US');
Inheritance
Available Extensions

Constructors

TruncateToFixedNonWhitespaceLengthTransformation({required int length, required String truncationIndicator, required TruncateAt truncateAt})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
The maximum number of non-whitespace characters to allow in a transformed String.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
truncateAt TruncateAt
Whether to truncate from the start or end of the input.
final
truncationIndicator String
The truncation indicator that should be prepended or appended if a String is truncated, subject to available space.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
transform(String input, String locale) String
Transforms input into an instance of U using the provided locale.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited