startsWith method

bool startsWith(
  1. StringView prefix
)

Whether this view starts with prefix.

Implementation

bool startsWith(StringView prefix) {
  final prefixLength = prefix.byteLength;
  if (prefixLength > byteLength) return false;
  for (var i = 0; i < prefixLength; i++) {
    if (bytes[start + i] != prefix.bytes[prefix.start + i]) return false;
  }
  return true;
}