limitLength method

void limitLength({
  1. int length = 2000,
  2. String? ellipsis = '...',
})
inherited

Limits the length of the content of the builder to length.

If content is shorter than length, this method does nothing. Else, it truncates content and appends ellipsis (if non-null) in a way that the new content length equals length.

Implementation

void limitLength({int length = 2000, String? ellipsis = '...'}) {
  if (_content.length < length) {
    return;
  }

  ellipsis ??= '';

  final cutContent = content.substring(0, length - ellipsis.length);
  content = cutContent + ellipsis;
}