encodeHeaderValue method Null safety

String encodeHeaderValue(
  1. String value,
  2. [TransferEncoding transferEncoding = TransferEncoding.quotedPrintable]
)

Encodes the specified header value.

Specify the encoding when not the default quoted-printable encoding should be used.

Implementation

static String encodeHeaderValue(String value,
    [TransferEncoding transferEncoding = TransferEncoding.quotedPrintable]) {
  switch (transferEncoding) {
    case TransferEncoding.quotedPrintable:
      return MailCodec.quotedPrintable.encodeHeader(value);
    case TransferEncoding.base64:
      return MailCodec.base64.encodeHeader(value);
    default:
      return value;
  }
}