removeLastChar method

String removeLastChar()

Removes the last character from the string.

Implementation

String removeLastChar() =>
    // Return empty if too short, otherwise return the substringSafe without the last character.
    (length < 1) ? '' : substringSafe(0, length - 1);