abbreviate method

String abbreviate(
  1. int maxWidth, {
  2. int offset = 0,
})

Abbreviate a string to maxWidth by truncating the string and adding '...' to then truncated string. If offset is passed then the we begin abbreviating from that index into the string.

'Hello World'.abbreviate(6) == 'Hel...'

The minimum value for maxWidth is 4

Implementation

String abbreviate(int maxWidth, {int offset = 0}) =>
    Part.abbreviate(this, maxWidth);