maxCursor method

int maxCursor(
  1. String text
)

The last offset the cursor may take in text (before the suffix).

Implementation

int maxCursor(String text) => suffix.isNotEmpty && text.endsWith(suffix)
    ? text.length - suffix.length
    : text.length;