toRequest method
Future<MultipartRequest>
toRequest(
- MultipartRequest request
)
override
Implementation
Future<http.MultipartRequest> toRequest(http.MultipartRequest request) async {
var fields = <String, String>{};
fields['from'] = from;
fields['to'] = to.join(',');
fields['subject'] = subject;
if (cc != null) fields['cc'] = cc!.join(',');
if (bcc != null) fields['bcc'] = bcc!.join(',');
if (tags != null) fields['o:tag'] = tags!.join(',');
if (attachments != null) {
for (var attachment in attachments!) {
request.files.add(
await http.MultipartFile.fromPath('attachment', attachment.path),
);
}
}
if (inline != null) fields['inline'] = inline!.join(',');
options?.toRequest(request);
request.fields.addAll({...content.asMap(), ...fields});
return request;
}