findContentInfo method
List<ContentInfo>
findContentInfo({
- ContentDisposition disposition = ContentDisposition.attachment,
- bool? withCleanParts,
- bool? complete,
Retrieves all content info of parts with the specified disposition
Content-Type
.
By default the content info with ContentDisposition.attachment
are retrieved.
Typically this used to list all attachments of a message.
Note that either the message contents (BODY[]
) or the BODYSTRUCTURE
is required to reliably list all matching content elements.
All fetchId parsed from the BODYSTRUCTURE
are returned in a form compatible
with the body parts tree unless withCleanParts
is false.
Implementation
List<ContentInfo> findContentInfo(
{ContentDisposition disposition = ContentDisposition.attachment,
bool? withCleanParts,
bool? complete}) {
withCleanParts ??= true;
final result = <ContentInfo>[];
if (body != null) {
body!.collectContentInfo(disposition, result,
withCleanParts: withCleanParts, complete: complete);
} else if (parts?.isNotEmpty ?? false || body == null) {
collectContentInfo(disposition, result, null, complete: complete);
}
return result;
}