MenuButton class abstract
This object describes the bot's menu button in a private chat. It should be
one of MenuButtonCommands, MenuButtonWebApp, or MenuButtonDefault.
If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise, the default menu button is applied. By default, the menu button opens the list of bot commands.
- Available extensions
- Annotations
-
- @Freezed.new(unionKey: 'type', unionValueCase: FreezedUnionCase.snake)
Constructors
- MenuButton({@JsonKey.new(name: 'type') @Default.new(MenuButtonType.defaultButton) MenuButtonType type})
-
Describes that no specific value for the menu button was set.
constfactory
- MenuButton.commands({@JsonKey.new(name: 'type') @Default.new(MenuButtonType.commands) MenuButtonType type})
-
Represents a menu button, which opens the bot's list of commands.
constfactory
-
MenuButton.fromJson(Map<
String, dynamic> json) -
Creates a new MenuButton object. This method decides which MenuButton
subclass to use based on the
typefield.factory - MenuButton.webApp({@JsonKey.new(name: 'type') @Default.new(MenuButtonType.webApp) MenuButtonType type, @JsonKey.new(name: 'text') required String text, @JsonKey.new(name: 'web_app') required WebAppInfo webApp})
-
Represents a menu button, which launches a Web App.
constfactory
Properties
-
copyWith
→ $MenuButtonCopyWith<
MenuButton> -
Create a copy of MenuButton
with the given fields replaced by the non-null parameter values.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → MenuButtonType
-
Type of the menu button
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(MenuButtonDefault value), {required TResult webApp(MenuButtonWebApp value), required TResult commands(MenuButtonCommands value)}) → TResult -
Available on MenuButton, provided by the MenuButtonPatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> (TResult? $default(MenuButtonDefault value)?, {TResult? webApp(MenuButtonWebApp value)?, TResult? commands(MenuButtonCommands value)?}) → TResult? -
Available on MenuButton, provided by the MenuButtonPatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> (TResult $default(MenuButtonDefault value)?, {TResult webApp(MenuButtonWebApp value)?, TResult commands(MenuButtonCommands value)?, required TResult orElse()}) → TResult -
Available on MenuButton, provided by the MenuButtonPatterns extension
A variant ofmapthat fallback to returningorElse. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this MenuButton to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited