fromFile static method

FaceTemplate fromFile(
  1. String? path
)

Imports the face template object from a file.

param path Path to the file to import the face template object from. return The newly created face template. throws FaceException An error has occurred during Face Library execution.

Implementation

static FaceTemplate fromFile(String? path) {
  FaceTemplate faceTemplate = FaceTemplate();
  Pointer<Char>? pPath = path?.toNativeUtf8().cast<Char>();
  try {
    var err = faceSDK.id3FaceTemplate_FromFile(faceTemplate.handle, pPath ?? nullptr);
    if (err != FaceError.success.value) {
      faceTemplate.dispose();
      throw FaceException(err);
    }
    return faceTemplate;
  } finally {
    if (pPath != null) {
      calloc.free(pPath);
    }
  }
}