a2uiPart function

DataPart a2uiPart(
  1. List<A2uiEnvelope> envelopes, {
  2. String? source,
})

Builds an a2ui data part wrapping the given envelopes.

source is the A2UI Express block the envelopes were compiled from. It is stored under a2uiExpressMetadataKey so the block can be replayed verbatim as history.

Implementation

DataPart a2uiPart(List<A2uiEnvelope> envelopes, {String? source}) {
  return DataPart(
    data: {'messages': envelopes},
    metadata: {'mimeType': a2uiMimeType, a2uiExpressMetadataKey: ?source},
  );
}