RVAImage.open constructor

RVAImage.open(
  1. Uint8List bytes
)

Parse and integrity-validate a .rva package.

Implementation

factory RVAImage.open(Uint8List bytes) {
  final pointer = malloc<Uint8>(bytes.length);
  try {
    pointer.asTypedList(bytes.length).setAll(0, bytes);
    final handle = _rvaOpen(pointer, bytes.length);
    if (handle == nullptr) {
      throw StateError('rva_open failed: ${RVAImage.lastError()}');
    }
    return RVAImage._(handle);
  } finally {
    malloc.free(pointer);
  }
}