truncateSqliteWidth function

String truncateSqliteWidth(
  1. String value,
  2. int width
)

Truncates value to width characters, ending with an ellipsis when cut (omp's truncateToWidth, measured in code units).

Implementation

String truncateSqliteWidth(String value, int width) {
  if (value.length <= width) return value;
  if (width <= 1) return '…';
  return '${value.substring(0, width - 1)}…';
}