addUserMetadata method

void addUserMetadata(
  1. String key,
  2. Uint8List userMetadata
)

Saves custom metadata in the log.

This method allows adding a user-defined key-value pair to the log metadata. The key is a string identifier, and the value is a buffer (Uint8List value) containing the associated data. This method must be called before stopping the recording to ensure the metadata is saved in the final log.

Parameters

  • IN key The key of the user metadata.
  • IN userMetata The buffer to be recorded.

Throws

  • An exception if it fails

Implementation

void addUserMetadata(final String key, final Uint8List userMetadata) {
  final dynamic dataBufferPointer =
      GemKitPlatform.instance.toNativePointer(userMetadata);
  objectMethod(
    _pointerId,
    'Recorder',
    'addUserMetadata',
    args: <String, dynamic>{
      'key': key,
      'dataBuffer': dataBufferPointer.address,
      'dataBufferSize': userMetadata.length,
    },
  );

  GemKitPlatform.instance.freeNativePointer(dataBufferPointer);
}