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.changeLanguage({required String locale})
Silent action: switch the chat UI language live to locale. Emitted by the backend's change_language platform tool and carried on RichContentResponse.actions (never rendered as a button). The action handler dispatches it straight to ChatViewModel.setLocale.
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.requestInput({@JsonKey.new(name: 'input_type') required String inputType, required String label, @Default.new('both') String source, @Default.new('primary') String style})
Action that asks the user to share a specific kind of input (photo, audio, …) to continue. The SDK renders a tappable chip below the message and pulses the input-bar attach button — so the user has both a one-tap affordance and a visual nudge to the existing upload button.
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

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 openUrl(OpenUrlAction value), required TResult sendMessage(SendMessageAction value), required TResult callback(CallbackAction value), required TResult requestInput(RequestInputAction value), required TResult changeLanguage(ChangeLanguageAction 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? requestInput(RequestInputAction value)?, TResult? changeLanguage(ChangeLanguageAction 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)?, TResult requestInput(RequestInputAction value)?, TResult changeLanguage(ChangeLanguageAction 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 url, String label, bool openInApp, String style)?, TResult callback(String callbackId, String label, Map<String, dynamic>? payload, String style)?, TResult requestInput(String inputType, String label, String source, String style)?, TResult changeLanguage(String locale)?, 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 url, String label, bool openInApp, String style), required TResult callback(String callbackId, String label, Map<String, dynamic>? payload, String style), required TResult requestInput(String inputType, String label, String source, String style), required TResult changeLanguage(String locale)}) → 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 url, String label, bool openInApp, String style)?, TResult? callback(String callbackId, String label, Map<String, dynamic>? payload, String style)?, TResult? requestInput(String inputType, String label, String source, String style)?, TResult? changeLanguage(String locale)?}) → 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