RichComponent class sealed
Base sealed class for all rich content components.
- Available extensions
- Annotations
-
- @Freezed.new(unionKey: 'type')
Constructors
-
Button group component for action buttons
constfactory
-
RichComponent.card({required String id, RichImage? image, required String title, String? subtitle, String? description, @JsonKey.new(fromJson: _metadataFromJson) Map<
String, String> ? metadata, List<RichAction> ? actions}) -
Card component with image, title, description, and actions
constfactory
-
RichComponent.carousel({required String id, required List<
RichComponent> items, CarouselConfig? config}) -
Carousel component for horizontal scrolling items
constfactory
-
RichComponent.fromJson(Map<
String, dynamic> json) -
factory
-
RichComponent.image({required String id, required String url, String? alt, String? caption, @JsonKey.new(name: 'aspect_ratio') String? aspectRatio, List<
RichAction> ? actions}) -
Standalone image component
constfactory
-
RichComponent.productList({required String id, required List<
RichComponent> items, ProductListConfig? config}) -
Product list component for vertical or grid layouts
constfactory
- RichComponent.text({required String content, @Default.new('markdown') String format})
-
Text component for markdown or plain text
constfactory
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
-
map<
TResult extends Object?> ({required TResult text(TextComponent value), required TResult card(CardComponent value), required TResult carousel(CarouselComponent value), required TResult productList(ProductListComponent value), required TResult image(ImageComponent value), required TResult buttonGroup(ButtonGroupComponent value)}) → TResult -
Available on RichComponent, provided by the RichComponentPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? text(TextComponent value)?, TResult? card(CardComponent value)?, TResult? carousel(CarouselComponent value)?, TResult? productList(ProductListComponent value)?, TResult? image(ImageComponent value)?, TResult? buttonGroup(ButtonGroupComponent value)?}) → TResult? -
Available on RichComponent, provided by the RichComponentPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult text(TextComponent value)?, TResult card(CardComponent value)?, TResult carousel(CarouselComponent value)?, TResult productList(ProductListComponent value)?, TResult image(ImageComponent value)?, TResult buttonGroup(ButtonGroupComponent value)?, required TResult orElse()}) → TResult -
Available on RichComponent, provided by the RichComponentPatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult text(String content, String format)?, TResult card(String id, RichImage? image, String title, String? subtitle, String? description, Map< String, String> ? metadata, List<RichAction> ? actions)?, TResult carousel(String id, List<RichComponent> items, CarouselConfig? config)?, TResult productList(String id, List<RichComponent> items, ProductListConfig? config)?, TResult image(String id, String url, String? alt, String? caption, String? aspectRatio, List<RichAction> ? actions)?, TResult buttonGroup(String id, List<RichButton> buttons, String layout)?, required TResult orElse()}) → TResult -
Available on RichComponent, provided by the RichComponentPatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this RichComponent to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult text(String content, String format), required TResult card(String id, RichImage? image, String title, String? subtitle, String? description, Map< String, String> ? metadata, List<RichAction> ? actions), required TResult carousel(String id, List<RichComponent> items, CarouselConfig? config), required TResult productList(String id, List<RichComponent> items, ProductListConfig? config), required TResult image(String id, String url, String? alt, String? caption, String? aspectRatio, List<RichAction> ? actions), required TResult buttonGroup(String id, List<RichButton> buttons, String layout)}) → TResult -
Available on RichComponent, provided by the RichComponentPatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? text(String content, String format)?, TResult? card(String id, RichImage? image, String title, String? subtitle, String? description, Map< String, String> ? metadata, List<RichAction> ? actions)?, TResult? carousel(String id, List<RichComponent> items, CarouselConfig? config)?, TResult? productList(String id, List<RichComponent> items, ProductListConfig? config)?, TResult? image(String id, String url, String? alt, String? caption, String? aspectRatio, List<RichAction> ? actions)?, TResult? buttonGroup(String id, List<RichButton> buttons, String layout)?}) → TResult? -
Available on RichComponent, provided by the RichComponentPatterns extension
A variant ofwhenthat fallback to returningnull
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited