SentryEnvelope.fromTransaction constructor

SentryEnvelope.fromTransaction(
  1. SentryTransaction transaction,
  2. SdkVersion sdkVersion, {
  3. String? dsn,
  4. SentryTraceContextHeader? traceContext,
  5. List<SentryAttachment>? attachments,
})

Create a SentryEnvelope containing one SentryEnvelopeItem which holds the SentryTransaction data.

Implementation

factory SentryEnvelope.fromTransaction(
  SentryTransaction transaction,
  SdkVersion sdkVersion, {
  String? dsn,
  SentryTraceContextHeader? traceContext,
  List<SentryAttachment>? attachments,
}) {
  return SentryEnvelope(
    SentryEnvelopeHeader(
      transaction.eventId,
      sdkVersion,
      dsn: dsn,
      traceContext: traceContext,
    ),
    [
      SentryEnvelopeItem.fromTransaction(transaction),
      if (attachments != null)
        ...attachments.map((e) => SentryEnvelopeItem.fromAttachment(e))
    ],
  );
}