decodeBinary method

  1. @override
Uint8List decodeBinary(
  1. String? contentTransferEncoding
)
override

Decodes the data represented by the mime data

Implementation

@override
Uint8List decodeBinary(String? contentTransferEncoding) {
  final contentTransferEncodingLC = contentTransferEncoding?.toLowerCase();
  if (_bodyStartIndex == null ||
      // do not try to decode textual content:
      contentTransferEncodingLC == '7bit' ||
      contentTransferEncodingLC == '8bit' ||
      contentTransferEncodingLC == 'quoted-printable') {
    return _bodyData;
  }
  // even with a 'binary' content transfer encoding there are \r\n
  // characters that need to be handled,
  // so translate to text first
  final dataText = utf8.decode(_bodyData);

  return MailCodec.decodeBinary(dataText, contentTransferEncodingLC);
}