hasTextPart method Null safety

bool hasTextPart(
  1. {int? depth}
)

Checks if this MIME part or a child is textual.

depth optional depth, use 1 if only direct children should be checked

Implementation

bool hasTextPart({int? depth}) {
  if (isTextMediaType()) {
    return true;
  }
  if (parts != null) {
    if (depth != null) {
      if (--depth < 0) {
        return false;
      }
    }
    for (final part in parts!) {
      if (part.hasTextPart(depth: depth)) {
        return true;
      }
    }
  }
  return false;
}