MessageElement class abstract
Abstract base class for message content elements.
This class implements the Strategy Pattern for message content rendering, allowing different types of content (text, images, files, etc.) to be displayed within messages while maintaining a consistent interface.
Each message element is responsible for:
- Converting itself to a displayable Widget
- Supporting immutable updates through copyWith
- Maintaining its own state and properties
Example implementation:
class TextElement extends MessageElement {
final String text;
TextElement(this.text);
@override
Widget toWidget(BuildContext context) {
return Text(text);
}
@override
MessageElement copyWith() => TextElement(text);
}
Constructors
- MessageElement()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
) → MessageElement - Creates a copy of this element.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toWidget(
BuildContext context) → Widget - Converts this element to a displayable Flutter widget.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited