findFirst method

BodyPart? findFirst(
  1. MediaSubtype subtype
)

Implementation

BodyPart? findFirst(MediaSubtype subtype) {
  if (contentType?.mediaType.sub == subtype) {
    return this;
  }
  if (parts?.isNotEmpty ?? false) {
    for (final part in parts!) {
      final first = part.findFirst(subtype);
      if (first != null) {
        return first;
      }
    }
  }
  return null;
}