endsWith method

bool endsWith(
  1. String pattern
)

Checks whether the string view ends with the given pattern.

Implementation

bool endsWith(String pattern) {
  if (pattern.length > length) return false;
  int offset = length - pattern.length;
  for (int i = 0; i < pattern.length; i++) {
    if (_string[_start + offset + i] != pattern[i]) return false;
  }
  return true;
}