getIssuingAgencyCode method

String? getIssuingAgencyCode()

Gets the the Issuing Agency Code (IAC). For ISO 22376:2023 format only.

return The Issuing Agency Code (IAC). For ISO 22376:2023 format only. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String? getIssuingAgencyCode() {
  Pointer<Char> pIssuingAgencyCode = nullptr;
  Pointer<Int> pIssuingAgencyCodeSize = calloc.allocate(1);
  pIssuingAgencyCodeSize[0] = -1;
  try {
    var err = biosealSDK.id3Bioseal_GetIssuingAgencyCode(_pHandle.value, pIssuingAgencyCode, pIssuingAgencyCodeSize);
    if (err == BiosealError.objectDoesNotExist.value) {
      return null;
    }
    if (err == BiosealError.insufficientBuffer.value) {
      pIssuingAgencyCode = calloc.allocate(pIssuingAgencyCodeSize.value);
      err = biosealSDK.id3Bioseal_GetIssuingAgencyCode(_pHandle.value, pIssuingAgencyCode, pIssuingAgencyCodeSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vIssuingAgencyCode = utf8.decode(Uint8List.fromList(pIssuingAgencyCode.cast<Uint8>().asTypedList(pIssuingAgencyCodeSize.value)));
    return vIssuingAgencyCode;
  } finally {
    calloc.free(pIssuingAgencyCode);
    calloc.free(pIssuingAgencyCodeSize);
  }
}