TruncateToFixedLengthTransformation class
A transformation to convert a String into a truncated variant that contains at most length characters.
If the input value exceeds length 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 = TruncateToFixedLengthTransformation(
length: 12,
truncationIndicator: '~',
truncateAt: TruncateAt.end,
);
// 'A string th~'
transformation.transform('A string that is too long', 'en_US');
- Inheritance
-
- Object
- Transformation<
String, String> - TruncateToFixedLengthTransformation
- Available Extensions
Constructors
- TruncateToFixedLengthTransformation({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 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 ofU
using the providedlocale
.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited