limitFromEnd method

String? limitFromEnd(
  1. int maxSize
)

Shrinks the string to be no more than maxSize in length, extending from the end. Example: In a string with 10 characters, a maxSize of 3 would return the last 3 characters.

Implementation

String? limitFromEnd(int maxSize) => (this?.length ?? 0) < maxSize
    ? this
    : this!.substring(this!.length - maxSize);