getModuleName static method

String getModuleName(
  1. int index
)

Retrieves the name of the specified license module.

param index Index of the module, starting from 0. return The license module name. throws FaceException An error has occurred during Face Library execution.

Implementation

static String getModuleName(int index) {
  Pointer<Char> pName = calloc.allocate(256);
  Pointer<Int> pNameSize = calloc.allocate(1);
  pNameSize[0] = 256;
  try {
    var err = faceSDK.id3FaceLicense_GetModuleName(index, pName, pNameSize);
    if (err == FaceError.insufficientBuffer.value) {
      calloc.free(pName);
      pName = calloc.allocate(pNameSize.value);
      err = faceSDK.id3FaceLicense_GetModuleName(index, pName, pNameSize);
      if (err != FaceError.success.value) {
        throw FaceException(err);
      }
    }
    final vName = utf8.decode(Uint8List.fromList(pName.cast<Uint8>().asTypedList(pNameSize.value)));
    return vName;
  } finally {
    calloc.free(pName);
    calloc.free(pNameSize);
  }
}