MessageKind class sealed

Represents different types of chat messages using sealed class pattern. This enables exhaustive pattern matching with switch expressions.

Example usage:

final widget = switch (messageKind) {
  TextMessageKind(:final text) => Text(text),
  ImageMessageKind(:final imageProvider) => Image(image: imageProvider),
  HtmlMessageKind(:final htmlData) => HtmlWidget(htmlData),
  QuickReplyMessageKind(:final quickReplies) => QuickReplyWidget(quickReplies),
  CarouselMessageKind(:final carouselItems) => CarouselWidget(carouselItems),
  CustomMessageKind(:final custom) => CustomWidget(custom),
};
Implementers

Constructors

MessageKind.carousel(List<CarouselItem> carouselItems)
Creates a carousel message with items
factory
MessageKind.custom(dynamic custom)
Creates a custom message with user-defined content
factory
MessageKind.html(String htmlData)
Creates an HTML message
factory
MessageKind.imageProvider(ImageProvider<Object> imageProvider)
Creates an image message with an ImageProvider
factory
MessageKind.quickReply(List<QuickReplyItem> quickReplies)
Creates a quick reply message with options
factory
MessageKind.text(String text)
Creates a text message
factory

Properties

carouselItems List<CarouselItem>
Carousel items (empty list if not CarouselMessageKind)
no setter
custom → dynamic
Custom data (only available for CustomMessageKind)
no setter
hashCode int
The hash code for this object.
no setterinherited
htmlData String?
HTML data (only available for HtmlMessageKind)
no setter
imageProvider ImageProvider<Object>?
Image provider (only available for ImageMessageKind)
no setter
quickReplies List<QuickReplyItem>
Quick replies (empty list if not QuickReplyMessageKind)
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String?
Text content (only available for TextMessageKind)
no setter

Methods

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