loadModelBuffer static method

void loadModelBuffer(
  1. Uint8List? modelBuffer,
  2. FaceModel faceModel,
  3. ProcessingUnit processingUnit
)

Loads a model into memory from the specified buffer.

param modelBuffer A buffer containing the AI model to be loaded. param faceModel The AI model to be loaded. param processingUnit The processing unit to be used. throws FaceException An error has occurred during Face Library execution.

Implementation

static void loadModelBuffer(Uint8List? modelBuffer, FaceModel faceModel, ProcessingUnit processingUnit) {
  Pointer<UnsignedChar>? pModelBuffer;
  if (modelBuffer != null) {
  	pModelBuffer = calloc.allocate<UnsignedChar>(modelBuffer.length);
  	pModelBuffer.cast<Uint8>().asTypedList(modelBuffer.length).setAll(0, modelBuffer);
  }
  try {
    var err = faceSDK.id3FaceLibrary_LoadModelBuffer(pModelBuffer ?? nullptr, modelBuffer?.length ?? 0, faceModel.value, processingUnit.value);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
  } finally {
    if (pModelBuffer != null) {
      calloc.free(pModelBuffer);
    }
  }
}