removeSuffix method

String removeSuffix(
  1. String suffix
)

Remve suffix from a string.

Implementation

String removeSuffix(String suffix) {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return '';
  }
  if (this!.endsWith(suffix)) {
    return this!.substring(0, this!.length - suffix.length);
  }
  return this!;
}