getVersion static method

String getVersion()

Retrieves the library version as a X.Y.Z formatted string.

return A string that identifies the library version. throws FaceException An error has occurred during Face Library execution.

Implementation

static String getVersion() {
  Pointer<Char> pLibraryVersion = calloc.allocate(8);
  Pointer<Int> pLibraryVersionSize = calloc.allocate(1);
  pLibraryVersionSize[0] = 8;
  try {
    var err = faceSDK.id3FaceLibrary_GetVersion(pLibraryVersion, pLibraryVersionSize);
    if (err == FaceError.insufficientBuffer.value) {
      calloc.free(pLibraryVersion);
      pLibraryVersion = calloc.allocate(pLibraryVersionSize.value);
      err = faceSDK.id3FaceLibrary_GetVersion(pLibraryVersion, pLibraryVersionSize);
      if (err != FaceError.success.value) {
        throw FaceException(err);
      }
    }
    final vLibraryVersion = utf8.decode(Uint8List.fromList(pLibraryVersion.cast<Uint8>().asTypedList(pLibraryVersionSize.value)));
    return vLibraryVersion;
  } finally {
    calloc.free(pLibraryVersion);
    calloc.free(pLibraryVersionSize);
  }
}