maybeMap<TResult extends Object?> method

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

Implementation

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