RichAction class sealed

Base sealed class for all action types.

Available extensions
Annotations
  • @Freezed.new(unionKey: 'type')

Constructors

RichAction.callback({@JsonKey.new(name: 'callback_id') required String callbackId, required String label, Map<String, dynamic>? payload, @Default.new('secondary') String style})
Action to trigger a custom callback
const
factory
RichAction.fromJson(Map<String, dynamic> json)
factory
RichAction.openUrl({required String url, required String label, @JsonKey.new(name: 'open_in_app') @Default.new(false) bool openInApp, @Default.new('primary') String style})
Action to open a URL in browser or in-app
const
factory
RichAction.sendMessage({required String message, required String label, @JsonKey.new(name: 'show_in_chat') @Default.new(true) bool showInChat, @Default.new('secondary') String style})
Action to send a message in the chat
const
factory

Properties

copyWith → $RichActionCopyWith<RichAction>
Create a copy of RichAction with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
label String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style String
no setterinherited

Methods

map<TResult extends Object?>({required TResult openUrl(OpenUrlAction value), required TResult sendMessage(SendMessageAction value), required TResult callback(CallbackAction value)}) → TResult

Available on RichAction, provided by the RichActionPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? openUrl(OpenUrlAction value)?, TResult? sendMessage(SendMessageAction value)?, TResult? callback(CallbackAction value)?}) → TResult?

Available on RichAction, provided by the RichActionPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult openUrl(OpenUrlAction value)?, TResult sendMessage(SendMessageAction value)?, TResult callback(CallbackAction value)?, required TResult orElse()}) → TResult

Available on RichAction, provided by the RichActionPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult openUrl(String url, String label, bool openInApp, String style)?, TResult sendMessage(String message, String label, bool showInChat, String style)?, TResult callback(String callbackId, String label, Map<String, dynamic>? payload, String style)?, required TResult orElse()}) → TResult

Available on RichAction, provided by the RichActionPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this RichAction to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult openUrl(String url, String label, bool openInApp, String style), required TResult sendMessage(String message, String label, bool showInChat, String style), required TResult callback(String callbackId, String label, Map<String, dynamic>? payload, String style)}) → TResult

Available on RichAction, provided by the RichActionPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? openUrl(String url, String label, bool openInApp, String style)?, TResult? sendMessage(String message, String label, bool showInChat, String style)?, TResult? callback(String callbackId, String label, Map<String, dynamic>? payload, String style)?}) → TResult?

Available on RichAction, provided by the RichActionPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited