endsWith method

bool endsWith(
  1. Slice<T> needle
)

Returns true if needle is a suffix of the slice.

Implementation

bool endsWith(Slice<T> needle) {
  if (needle._end - needle._start > _end - _start) {
    return false;
  }
  for (var i = 0; i < needle._end - needle._start; i++) {
    if (_list[_end - i - 1] != needle._list[needle._end - i - 1]) {
      return false;
    }
  }
  return true;
}