# activateBuffer static method

Uint8List activateBuffer(

1. String? hardwareCode,
2. String? login,
3. String? password,
4. String? productReference,
5. String? commentary

)

Retrieves a license file buffer using customer credentials and a product reference and returns the license in a data buffer.

param hardwareCode The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function. param login The customer login. param password The customer password. param productReference The requested product reference. param commentary Commentary associated to this license activation, generally the host name. return The license data. throws DocumentException An error has occurred during Document Library execution.

## Implementation

    static Uint8List activateBuffer(String? hardwareCode, String? login, String? password, String? productReference, String? commentary) {
      Pointer<Char>? pHardwareCode = hardwareCode?.toNativeUtf8().cast<Char>();
      Pointer<Char>? pLogin = login?.toNativeUtf8().cast<Char>();
      Pointer<Char>? pPassword = password?.toNativeUtf8().cast<Char>();
      Pointer<Char>? pProductReference = productReference?.toNativeUtf8().cast<Char>();
      Pointer<Char>? pCommentary = commentary?.toNativeUtf8().cast<Char>();
      Pointer<UnsignedChar> pLicenseFileBuffer = calloc.allocate(2048);
      Pointer<Int> pLicenseFileBufferSize = calloc.allocate(1);
      pLicenseFileBufferSize[0] = 2048;
      try {
        var err = documentSDK.id3DocumentLicense_ActivateBuffer(pHardwareCode ?? nullptr, pLogin ?? nullptr, pPassword ?? nullptr, pProductReference ?? nullptr, pCommentary ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
        if (err == DocumentError.insufficientBuffer.value) {
          calloc.free(pLicenseFileBuffer);
          pLicenseFileBuffer = calloc.allocate(pLicenseFileBufferSize.value);
          err = documentSDK.id3DocumentLicense_ActivateBuffer(pHardwareCode ?? nullptr, pLogin ?? nullptr, pPassword ?? nullptr, pProductReference ?? nullptr, pCommentary ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
        }
        if (err != DocumentError.success.value) {
          throw DocumentException(err);
        }
        final vLicenseFileBuffer = Uint8List.fromList(pLicenseFileBuffer.cast<Uint8>().asTypedList(pLicenseFileBufferSize.value));
        return vLicenseFileBuffer;
      } finally {
        if (pHardwareCode != null) {
          calloc.free(pHardwareCode);
        }
        if (pLogin != null) {
          calloc.free(pLogin);
        }
        if (pPassword != null) {
          calloc.free(pPassword);
        }
        if (pProductReference != null) {
          calloc.free(pProductReference);
        }
        if (pCommentary != null) {
          calloc.free(pCommentary);
        }
        calloc.free(pLicenseFileBuffer);
        calloc.free(pLicenseFileBufferSize);
      }
    }