getDocumentIssuingCountry method

String getDocumentIssuingCountry()

Gets the the identifier of the country issuing the document. For AFNOR XP Z42-101 only.

return The identifier of the country issuing the document. For AFNOR XP Z42-101 only. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String getDocumentIssuingCountry() {
  Pointer<Char> pDocumentIssuingCountry = nullptr;
  Pointer<Int> pDocumentIssuingCountrySize = calloc.allocate(1);
  pDocumentIssuingCountrySize[0] = -1;
  try {
    var err = biosealSDK.id3Bioseal_GetDocumentIssuingCountry(_pHandle.value, pDocumentIssuingCountry, pDocumentIssuingCountrySize);
    if (err == BiosealError.insufficientBuffer.value) {
      pDocumentIssuingCountry = calloc.allocate(pDocumentIssuingCountrySize.value);
      err = biosealSDK.id3Bioseal_GetDocumentIssuingCountry(_pHandle.value, pDocumentIssuingCountry, pDocumentIssuingCountrySize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vDocumentIssuingCountry = utf8.decode(Uint8List.fromList(pDocumentIssuingCountry.cast<Uint8>().asTypedList(pDocumentIssuingCountrySize.value)));
    return vDocumentIssuingCountry;
  } finally {
    calloc.free(pDocumentIssuingCountry);
    calloc.free(pDocumentIssuingCountrySize);
  }
}