removePrefix method

String removePrefix(
  1. Pattern pattern
)

If the string starts with the prefix pattern returns this String with the prefix removed, otherwise return this.

Implementation

String removePrefix(Pattern pattern) {
  if (pattern is String && startsWith(pattern)) {
    return substring(pattern.length);
  }
  final match = pattern.matchAsPrefix(this);
  if (match != null && match.end > 0) {
    return substring(match.end);
  }
  return this;
}