startsWith method

bool startsWith(
  1. Slice<T> needle
)

Returns true if needle is a prefix of the slice.

Implementation

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