fromBuffer static method
- Uint8List? data
Imports the face template object from a buffer.
param data Buffer 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 fromBuffer(Uint8List? data) {
FaceTemplate faceTemplate = FaceTemplate();
Pointer<UnsignedChar>? pData;
if (data != null) {
pData = calloc.allocate<UnsignedChar>(data.length);
pData.cast<Uint8>().asTypedList(data.length).setAll(0, data);
}
try {
var err = faceSDK.id3FaceTemplate_FromBuffer(faceTemplate.handle, pData ?? nullptr, data?.length ?? 0);
if (err != FaceError.success.value) {
faceTemplate.dispose();
throw FaceException(err);
}
return faceTemplate;
} finally {
if (pData != null) {
calloc.free(pData);
}
}
}