import 'package:model/model.dart'; extension ListAttachmentExtension on List { num totalSize() { if (isNotEmpty) { final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList(); final totalSize = currentListSize.reduce((sum, size) => sum + size); return totalSize; } return 0; } List get listAttachmentsDisplayedOutSide { return where((attachment) => attachment.disposition == ContentDisposition.attachment || attachment.noCid()) .toList(); } List get listAttachmentsDisplayedInContent { return where((attachment) => attachment.hasCid()) .toList(); } }