MessageContent class
The MessageContent class represents the content of an email.
The class provides factory constructors for creating instances of the class with different types of content. The three types of content are html, text, and template.
The class also provides a getter templateVariables which returns the _templateVariables
field as a JSON string,
but it will throw an exception if the type is not MessageContentType.template.
Examples:
using the MessageContent.html constructor:
var htmlContent = MessageContent.html("test");
using the MessageContent.text constructor:
var textContent = MessageContent.text("test");
using the MessageContent.template constructor:
var templateContent = MessageContent.template("test", {"test": "test"});
Constructors
- MessageContent.html(String value)
-
Initialises the class with value as html content, and sets
_type
to MessageContentType.html. -
MessageContent.template(String value, Map<
String, Object> templateVariables) -
Initialises the class with value as the template name,
and
_templateVariables
as a map of variables. Sets_type
to MessageContentType.template. - MessageContent.text(String value)
-
Initialises the class with value as text content, and sets
_type
to MessageContentType.text.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- templateVariables → String
-
Returns the
_templateVariables
field as a JSON string. Throws FormatException if type is not MessageContentType.template.no setter - type → MessageContentType
-
The type getter returns the type of content.
no setter
- value ↔ String
-
Holds the actual content of the email.
getter/setter pair
Methods
-
asMap(
) → Map< String, String> - Returns a map of the content.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited