getLicenseName static method

String getLicenseName()

Retrieves the license name.

return The license name. throws FaceException An error has occurred during Face Library execution.

Implementation

static String getLicenseName() {
  Pointer<Char> pLicenseName = calloc.allocate(256);
  Pointer<Int> pLicenseNameSize = calloc.allocate(1);
  pLicenseNameSize[0] = 256;
  try {
    var err = faceSDK.id3FaceLicense_GetLicenseName(pLicenseName, pLicenseNameSize);
    if (err == FaceError.insufficientBuffer.value) {
      calloc.free(pLicenseName);
      pLicenseName = calloc.allocate(pLicenseNameSize.value);
      err = faceSDK.id3FaceLicense_GetLicenseName(pLicenseName, pLicenseNameSize);
      if (err != FaceError.success.value) {
        throw FaceException(err);
      }
    }
    final vLicenseName = utf8.decode(Uint8List.fromList(pLicenseName.cast<Uint8>().asTypedList(pLicenseNameSize.value)));
    return vLicenseName;
  } finally {
    calloc.free(pLicenseName);
    calloc.free(pLicenseNameSize);
  }
}