fromBytesAsync static method

Future<Net> fromBytesAsync(
  1. String framework,
  2. Uint8List bufferModel, {
  3. Uint8List? bufferConfig,
})

Implementation

static Future<Net> fromBytesAsync(
  String framework,
  Uint8List bufferModel, {
  Uint8List? bufferConfig,
}) async {
  bufferConfig ??= Uint8List(0);
  final cFramework = framework.toNativeUtf8().cast<ffi.Char>();
  final bufM = VecUChar.fromList(bufferModel);
  final bufC = VecUChar.fromList(bufferConfig);
  final rval = await cvRunAsync<Net>(
      (callback) => cffi.Net_ReadNetBytes_Async(cFramework, bufM.ref, bufC.ref, callback), (c, p) {
    return c.complete(Net.fromPointer(p.cast<cvg.Net>()));
  });

  calloc.free(cFramework);

  return rval;
}