prepareMessageWithMediaType static method

MessageBuilder prepareMessageWithMediaType(
  1. MediaSubtype subtype, {
  2. TransferEncoding transferEncoding = TransferEncoding.eightBit,
})

Convenience method for initiating a message with the specified media subtype

In case you want to use 7bit instead of the default 8bit content transfer encoding, specify the optional encoding. You can also create a new MessageBuilder and call setContentType with the same effect when using the identical media subtype.

Implementation

static MessageBuilder prepareMessageWithMediaType(MediaSubtype subtype,
    {TransferEncoding transferEncoding = TransferEncoding.eightBit}) {
  final mediaType = subtype.mediaType;
  final builder = MessageBuilder()
    ..setContentType(mediaType)
    ..transferEncoding = transferEncoding;
  return builder;
}