getPartWithMediaSubtype method

MimePart? getPartWithMediaSubtype(
  1. MediaSubtype subtype
)

Searches the MimePart with the specified subtype.

Implementation

MimePart? getPartWithMediaSubtype(MediaSubtype subtype) {
  if (mediaType.sub == subtype) {
    return this;
  }
  final mimeParts = parts;
  if (mimeParts != null) {
    for (final mimePart in mimeParts) {
      final match = mimePart.getPartWithMediaSubtype(subtype);
      if (match != null) {
        return match;
      }
    }
  }
  return null;
}