Context.fromImage constructor Null safety

Context.fromImage(
  1. DynamicLibrary dll_handle,
  2. Uint8List data
)

Implementation

Context.fromImage(DynamicLibrary dll_handle, Uint8List data) : super(dll_handle, nullptr) {
  var constructor =
      dll_handle.lookupFunction<_Context_CreateFromEncodedImage_c, _Context_CreateFromEncodedImage_dart>(
          _context_namespace + "createFromEncodedImage");

  var exception = _getException();
  Pointer<Uint8> dataPointer = malloc.allocate<Uint8>(data.length);
  dataPointer.asTypedList(data.length).setAll(0, data);

  final newImpl = constructor(dataPointer, data.length, exception);

  tdvCheckException(exception, _dll_handle);

  this._impl = newImpl;

  malloc.free(dataPointer);
}