endsWithPattern method

bool endsWithPattern(
  1. Pattern exp
)

checks if string ends with pattern

Implementation

bool endsWithPattern(Pattern exp) {
  if (exp is String) {
    return endsWith(exp);
  }

  final matches = exp.allMatches(this);
  final last = matches._lastOrNull;
  if (last != null) {
    return last.end == length;
  }

  return false;
}