maybeMap<TResult extends Object?> method

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

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(BotCommandScopeAllChatAdministrators value)?
  allChatAdministrators,
  TResult Function(BotCommandScopeAllGroupChats value)? allGroupChats,
  TResult Function(BotCommandScopeAllPrivateChats value)? allPrivateChats,
  TResult Function(BotCommandScopeChat value)? chat,
  TResult Function(BotCommandScopeChatAdministrators value)?
  chatAdministrators,
  TResult Function(BotCommandScopeChatMember value)? chatMember,
  TResult Function(BotCommandScopeDefault value)? $default,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case BotCommandScopeAllChatAdministrators.constructor:
      if (allChatAdministrators != null) {
        return allChatAdministrators.call(
          this as BotCommandScopeAllChatAdministrators,
        );
      }
      break;
    case BotCommandScopeAllGroupChats.constructor:
      if (allGroupChats != null) {
        return allGroupChats.call(this as BotCommandScopeAllGroupChats);
      }
      break;
    case BotCommandScopeAllPrivateChats.constructor:
      if (allPrivateChats != null) {
        return allPrivateChats.call(this as BotCommandScopeAllPrivateChats);
      }
      break;
    case BotCommandScopeChat.constructor:
      if (chat != null) {
        return chat.call(this as BotCommandScopeChat);
      }
      break;
    case BotCommandScopeChatAdministrators.constructor:
      if (chatAdministrators != null) {
        return chatAdministrators.call(
          this as BotCommandScopeChatAdministrators,
        );
      }
      break;
    case BotCommandScopeChatMember.constructor:
      if (chatMember != null) {
        return chatMember.call(this as BotCommandScopeChatMember);
      }
      break;
    case BotCommandScopeDefault.constructor:
      if ($default != null) {
        return $default.call(this as BotCommandScopeDefault);
      }
      break;
  }
  return orElse.call();
}