SentryEnvelopeItem.fromEvent constructor

SentryEnvelopeItem.fromEvent(
  1. SentryEvent event
)

Create a SentryEnvelopeItem which holds the SentryEvent data.

Implementation

factory SentryEnvelopeItem.fromEvent(SentryEvent event) {
  final cachedItem =
      _CachedItem(() async => utf8JsonEncoder.convert(event.toJson()));

  return SentryEnvelopeItem(
    SentryEnvelopeItemHeader(
      event.type == 'feedback' ? 'feedback' : SentryItemType.event,
      cachedItem.getDataLength,
      contentType: 'application/json',
    ),
    cachedItem.getData,
    originalObject: event,
  );
}