SentryEnvelope.fromEvent constructor

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

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

Implementation

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