removeSuffix method
Removes the given suffix from the end of the string if it exists.
Example:
'text_suffix'.removeSuffix('_suffix'); // 'text'
Implementation
String removeSuffix(String suffix) => endsWith(suffix) ? substring(0, length - suffix.length) : this;