map<TResult extends Object?> method

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

Implementation

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,
}) {
  switch (getConstructor()) {
    case BotCommandScopeDefault.constructor:
      return $default.call(this as BotCommandScopeDefault);
    case BotCommandScopeAllPrivateChats.constructor:
      return allPrivateChats.call(this as BotCommandScopeAllPrivateChats);
    case BotCommandScopeAllGroupChats.constructor:
      return allGroupChats.call(this as BotCommandScopeAllGroupChats);
    case BotCommandScopeAllChatAdministrators.constructor:
      return allChatAdministrators
          .call(this as BotCommandScopeAllChatAdministrators);
    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);
  }
  throw StateError('not handled type Generator');
}