map<TResult extends Object?> method
- @optionalTypeArgs
- required TResult default_(
- BotCommandScopeDefault value
- required TResult allPrivateChats(
- BotCommandScopeAllPrivateChats value
- required TResult allGroupChats(
- BotCommandScopeAllGroupChats value
- required TResult allChatAdministrators(
- BotCommandScopeAllChatAdministrators value
- required TResult chat(
- BotCommandScopeChat value
- required TResult chatAdministrators(
- BotCommandScopeChatAdministrators value
- required TResult chatMember(
- BotCommandScopeChatMember value
A switch-like method, using callbacks.
Callbacks receives the raw object, upcasted. It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case final Subclass2 value:
return ...;
}
Implementation
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(BotCommandScopeDefault value) default_,
required TResult Function(BotCommandScopeAllPrivateChats value)
allPrivateChats,
required TResult Function(BotCommandScopeAllGroupChats value) allGroupChats,
required TResult Function(BotCommandScopeAllChatAdministrators value)
allChatAdministrators,
required TResult Function(BotCommandScopeChat value) chat,
required TResult Function(BotCommandScopeChatAdministrators value)
chatAdministrators,
required TResult Function(BotCommandScopeChatMember value) chatMember,
}) {
final _that = this;
switch (_that) {
case BotCommandScopeDefault():
return default_(_that);
case BotCommandScopeAllPrivateChats():
return allPrivateChats(_that);
case BotCommandScopeAllGroupChats():
return allGroupChats(_that);
case BotCommandScopeAllChatAdministrators():
return allChatAdministrators(_that);
case BotCommandScopeChat():
return chat(_that);
case BotCommandScopeChatAdministrators():
return chatAdministrators(_that);
case BotCommandScopeChatMember():
return chatMember(_that);
}
}