toTruncate method

String toTruncate(
  1. int length, [
  2. String? omission
])

Truncates string if it's longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to "...". Example: "hello" -> "hello" -> "hello"

Implementation

String toTruncate(int length, [String? omission]) =>
    truncate(this, length, omission);