add method

void add(
  1. String? key,
  2. FaceTemplate faceTemplateItem
)

Adds an item to the FaceTemplateDict object.

param key Unique key of the FaceTemplate item to add. param faceTemplateItem FaceTemplate item to add. throws FaceException An error has occurred during Face Library execution.

Implementation

void add(String? key, FaceTemplate faceTemplateItem) {
  Pointer<Char>? pKey = key?.toNativeUtf8().cast<Char>();
  try {
    var err = faceSDK.id3FaceTemplateDict_Add(_pHandle.value, pKey ?? nullptr, faceTemplateItem.handle);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
  } finally {
    if (pKey != null) {
      calloc.free(pKey);
    }
  }
}