setRecommendedTextEncoding method Null safety

TransferEncoding setRecommendedTextEncoding(
  1. bool supports8BitMessages
)

Implementation

TransferEncoding setRecommendedTextEncoding(bool supports8BitMessages) {
  var recommendedEncoding = TransferEncoding.quotedPrintable;
  final textHtml = getTextHtmlPart();
  final textPlain = getTextPlainPart();
  if (!supports8BitMessages) {
    if (_contains8BitCharacters(text) ||
        _contains8BitCharacters(textPlain?.text) ||
        _contains8BitCharacters(textHtml?.text)) {
      recommendedEncoding = TransferEncoding.quotedPrintable;
    } else {
      recommendedEncoding = TransferEncoding.sevenBit;
    }
  }
  transferEncoding = recommendedEncoding;
  textHtml?.transferEncoding = recommendedEncoding;
  textPlain?.transferEncoding = recommendedEncoding;
  return recommendedEncoding;
}