truncateWithEllipsis method

String truncateWithEllipsis(
  1. int maxLength
)

Trim string and add ... if it's too long.

Implementation

String truncateWithEllipsis(int maxLength) {
  if (length <= maxLength) return this;
  return '${substring(0, maxLength)}...';
}