removeFirstLastChar method

String removeFirstLastChar()

Removes both the first and the last character from the string.

Implementation

String removeFirstLastChar() =>
    // Return empty if too short, otherwise return the inner substring.
    (length < 2) ? '' : substring(1, length - 1);