map<TResult extends Object?> method

TResult map<TResult extends Object?>({
  1. required TResult allChatAdministrators(
    1. BotCommandScopeAllChatAdministrators value
    ),
  2. required TResult allGroupChats(
    1. BotCommandScopeAllGroupChats value
    ),
  3. required TResult allPrivateChats(
    1. BotCommandScopeAllPrivateChats value
    ),
  4. required TResult chat(
    1. BotCommandScopeChat value
    ),
  5. required TResult chatAdministrators(
    1. BotCommandScopeChatAdministrators value
    ),
  6. required TResult chatMember(
    1. BotCommandScopeChatMember value
    ),
  7. required TResult $default(
    1. BotCommandScopeDefault value
    ),
})

Implementation

TResult map<TResult extends Object?>({
  required TResult Function(BotCommandScopeAllChatAdministrators value)
  allChatAdministrators,
  required TResult Function(BotCommandScopeAllGroupChats value) allGroupChats,
  required TResult Function(BotCommandScopeAllPrivateChats value)
  allPrivateChats,
  required TResult Function(BotCommandScopeChat value) chat,
  required TResult Function(BotCommandScopeChatAdministrators value)
  chatAdministrators,
  required TResult Function(BotCommandScopeChatMember value) chatMember,
  required TResult Function(BotCommandScopeDefault value) $default,
}) {
  switch (getConstructor()) {
    case BotCommandScopeAllChatAdministrators.constructor:
      return allChatAdministrators.call(
        this as BotCommandScopeAllChatAdministrators,
      );
    case BotCommandScopeAllGroupChats.constructor:
      return allGroupChats.call(this as BotCommandScopeAllGroupChats);
    case BotCommandScopeAllPrivateChats.constructor:
      return allPrivateChats.call(this as BotCommandScopeAllPrivateChats);
    case BotCommandScopeChat.constructor:
      return chat.call(this as BotCommandScopeChat);
    case BotCommandScopeChatAdministrators.constructor:
      return chatAdministrators.call(
        this as BotCommandScopeChatAdministrators,
      );
    case BotCommandScopeChatMember.constructor:
      return chatMember.call(this as BotCommandScopeChatMember);
    case BotCommandScopeDefault.constructor:
      return $default.call(this as BotCommandScopeDefault);
  }
  throw StateError('not handled type Generator');
}