SentryEnvelopeItem.fromAttachment constructor

SentryEnvelopeItem.fromAttachment(
  1. SentryAttachment attachment
)

Implementation

factory SentryEnvelopeItem.fromAttachment(SentryAttachment attachment) {
  final cachedItem = _CachedItem(() async => await attachment.bytes);

  final header = SentryEnvelopeItemHeader(
    SentryItemType.attachment,
    cachedItem.getDataLength,
    contentType: attachment.contentType,
    fileName: attachment.filename,
    attachmentType: attachment.attachmentType,
  );
  return SentryEnvelopeItem(header, cachedItem.getData);
}