removeEnd method

String removeEnd(
  1. String end
)

Removes end from the end of the string, if it exists.

Implementation

String removeEnd(String end) =>
    // Check if the string ends with the target and remove it if so.
    endsWith(end) ? substring(0, length - end.length) : this;