SentryEnvelopeItem.fromTransaction constructor

SentryEnvelopeItem.fromTransaction(
  1. SentryTransaction transaction
)

Creates a SentryEnvelopeItem which sends SentryTransaction.

Implementation

factory SentryEnvelopeItem.fromTransaction(SentryTransaction transaction) {
  final cachedItem =
      _CachedItem(() async => utf8JsonEncoder.convert(transaction.toJson()));

  final header = SentryEnvelopeItemHeader(
    SentryItemType.transaction,
    cachedItem.getDataLength,
    contentType: 'application/json',
  );
  return SentryEnvelopeItem(header, cachedItem.getData,
      originalObject: transaction);
}