removeLastChar method

String removeLastChar()

Removes the last character from the string.

Implementation

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