EmailAttachment constructor

EmailAttachment({
  1. required String name,
  2. required Uint8List content,
  3. String contentType = 'application/octet-stream',
})

Creates an email attachment from in-memory bytes.

When contentType is omitted, it defaults to application/octet-stream.

Example:

final attachment = EmailAttachment(
  name: 'notes.txt',
  content: Uint8List.fromList(utf8.encode('Hello')),
  contentType: 'text/plain',
);

Implementation

EmailAttachment({required this.name, required this.content, this.contentType = 'application/octet-stream'});