formatMaxChars method

String formatMaxChars([
  1. int maxChars = 1
])

Returns input as a formatted string with a maximum amount of characters.

maxChars defaults to one.

Implementation

String formatMaxChars([int maxChars = 1]) {
  final strVal = this == null ? '' : this!.abs().toString();
  return strVal.length > maxChars ? '${'9' * maxChars}+' : strVal;
}