import 'package:model/model.dart'; extension ListAttachmentExtension on List { num totalSize() { num totalSize = 0; forEach((attachment) { if (attachment.size != null) { totalSize += attachment.size!.value; } }); return totalSize; } List get attachmentsWithDispositionAttachment { return where((attachment) => attachment.disposition == ContentDisposition.attachment).toList(); } List get attachmentWithDispositionInlines { return where((attachment) => attachment.disposition == ContentDisposition.inline && attachment.cidNotEmpty()) .toList(); } }