addText method
PartBuilder
addText(
- String text, {
- MediaType? mediaType,
- TransferEncoding transferEncoding = TransferEncoding.automatic,
- CharacterSet characterSet = CharacterSet.utf8,
- ContentDispositionHeader? disposition,
- bool insert = false,
Adds a text part to this message with the specified text
.
Specify the optional mediaType
, in case this is not a text/plain
message
and the characterSet
in case it is not ASCII.
Optionally specify the content disposition with disposition
.
Optionally set insert
to true to prepend and not append the part.
Optionally specify the transferEncoding
which detaults to TransferEncoding.automatic
.
Implementation
PartBuilder addText(String text,
{MediaType? mediaType,
TransferEncoding transferEncoding = TransferEncoding.automatic,
CharacterSet characterSet = CharacterSet.utf8,
ContentDispositionHeader? disposition,
bool insert = false}) {
mediaType ??= MediaSubtype.textPlain.mediaType;
var child = addPart(insert: insert);
child.setContentType(mediaType, characterSet: characterSet);
child.transferEncoding = transferEncoding;
child.contentDisposition = disposition;
child.text = text;
return child;
}