truncateString static method

String truncateString(
  1. String s,
  2. int limit
)

Implementation

static String truncateString(String s, int limit) {
  if (s.length > limit) {
    s = '${s.substring(0, limit - 4)}..${s.substring(s.length - 2)}';
  }
  return s;
}