isASTBinary static method

bool isASTBinary(
  1. Uint8List bytes
)

Whether bytes begins with the binary AST magic.

A cheap sniff for callers that dispatch on content rather than on a file extension. It says nothing about whether the rest of the file is valid.

Implementation

static bool isASTBinary(Uint8List bytes) {
  if (bytes.length < magic.length) return false;
  for (var i = 0; i < magic.length; ++i) {
    if (bytes[i] != magic[i]) return false;
  }
  return true;
}