startsWith method

bool startsWith(
  1. ByteArray other
)

Checks if the start of the underlying sequence equals to other sequence

Implementation

bool startsWith(ByteArray other) {
  if (other.isEmpty) return true;
  if (other.length > length) return false;

  for (var i = 0; i < other.bytes.length; i++) {
    if (other.bytes[i] != bytes[i]) {
      return false;
    }
  }

  return true;
}