fromBuffer static method
- Uint8List? data
Imports the face object from a buffer.
param data Buffer to import the face object from. return The newly created detected face. throws FaceException An error has occurred during Face Library execution.
Implementation
static DetectedFace fromBuffer(Uint8List? data) {
DetectedFace detectedFace = DetectedFace();
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.id3DetectedFace_FromBuffer(detectedFace.handle, pData ?? nullptr, data?.length ?? 0);
if (err != FaceError.success.value) {
detectedFace.dispose();
throw FaceException(err);
}
return detectedFace;
} finally {
if (pData != null) {
calloc.free(pData);
}
}
}