decodeBinary method

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

Decodes the data represented by the mime data

Implementation

@override
Uint8List decodeBinary(String? contentTransferEncoding) {
  if (_bodyStartIndex == null) {
    return Uint8List(0);
  }
  switch (contentTransferEncoding?.toLowerCase()) {
    case 'base64':
      return MailCodec.base64.decodeData(latin1.decode(_bodyData));
    case 'quoted-printable':
      return MailCodec.quotedPrintable.decodeData(latin1.decode(_bodyData));
    default:
      // 7bit, 8bit, binary or none: the body bytes are the payload; a UTF-8
      // round trip would corrupt or reject any non-ASCII byte
      return _bodyData;
  }
}