setPart method

void setPart(
  1. String fetchId,
  2. MimePart part
)

Sets the individually loaded part with the given fetchId.

call getPart(fetchId) to retrieve a part.

Implementation

void setPart(String fetchId, MimePart part) {
  _individualParts ??= <String, MimePart>{};
  final existing = body?.getChildPart(fetchId);
  if (existing != null) {
    part._contentTypeHeader = existing.contentType;
    part._contentDispositionHeader = existing.contentDisposition;
    part.addHeader(
        MailConventions.headerContentTransferEncoding, existing.encoding);
  }
  _individualParts![fetchId] = part;
}