maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult allowAll(
    1. UserPrivacySettingRuleAllowAll value
    )?,
  2. TResult allowBots(
    1. UserPrivacySettingRuleAllowBots value
    )?,
  3. TResult allowChatMembers(
    1. UserPrivacySettingRuleAllowChatMembers value
    )?,
  4. TResult allowContacts(
    1. UserPrivacySettingRuleAllowContacts value
    )?,
  5. TResult allowPremiumUsers(
    1. UserPrivacySettingRuleAllowPremiumUsers value
    )?,
  6. TResult allowUsers(
    1. UserPrivacySettingRuleAllowUsers value
    )?,
  7. TResult restrictAll(
    1. UserPrivacySettingRuleRestrictAll value
    )?,
  8. TResult restrictBots(
    1. UserPrivacySettingRuleRestrictBots value
    )?,
  9. TResult restrictChatMembers(
    1. UserPrivacySettingRuleRestrictChatMembers value
    )?,
  10. TResult restrictContacts(
    1. UserPrivacySettingRuleRestrictContacts value
    )?,
  11. TResult restrictUsers(
    1. UserPrivacySettingRuleRestrictUsers value
    )?,
  12. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(UserPrivacySettingRuleAllowAll value)? allowAll,
  TResult Function(UserPrivacySettingRuleAllowBots value)? allowBots,
  TResult Function(UserPrivacySettingRuleAllowChatMembers value)?
  allowChatMembers,
  TResult Function(UserPrivacySettingRuleAllowContacts value)? allowContacts,
  TResult Function(UserPrivacySettingRuleAllowPremiumUsers value)?
  allowPremiumUsers,
  TResult Function(UserPrivacySettingRuleAllowUsers value)? allowUsers,
  TResult Function(UserPrivacySettingRuleRestrictAll value)? restrictAll,
  TResult Function(UserPrivacySettingRuleRestrictBots value)? restrictBots,
  TResult Function(UserPrivacySettingRuleRestrictChatMembers value)?
  restrictChatMembers,
  TResult Function(UserPrivacySettingRuleRestrictContacts value)?
  restrictContacts,
  TResult Function(UserPrivacySettingRuleRestrictUsers value)? restrictUsers,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case UserPrivacySettingRuleAllowAll.constructor:
      if (allowAll != null) {
        return allowAll.call(this as UserPrivacySettingRuleAllowAll);
      }
      break;
    case UserPrivacySettingRuleAllowBots.constructor:
      if (allowBots != null) {
        return allowBots.call(this as UserPrivacySettingRuleAllowBots);
      }
      break;
    case UserPrivacySettingRuleAllowChatMembers.constructor:
      if (allowChatMembers != null) {
        return allowChatMembers.call(
          this as UserPrivacySettingRuleAllowChatMembers,
        );
      }
      break;
    case UserPrivacySettingRuleAllowContacts.constructor:
      if (allowContacts != null) {
        return allowContacts.call(
          this as UserPrivacySettingRuleAllowContacts,
        );
      }
      break;
    case UserPrivacySettingRuleAllowPremiumUsers.constructor:
      if (allowPremiumUsers != null) {
        return allowPremiumUsers.call(
          this as UserPrivacySettingRuleAllowPremiumUsers,
        );
      }
      break;
    case UserPrivacySettingRuleAllowUsers.constructor:
      if (allowUsers != null) {
        return allowUsers.call(this as UserPrivacySettingRuleAllowUsers);
      }
      break;
    case UserPrivacySettingRuleRestrictAll.constructor:
      if (restrictAll != null) {
        return restrictAll.call(this as UserPrivacySettingRuleRestrictAll);
      }
      break;
    case UserPrivacySettingRuleRestrictBots.constructor:
      if (restrictBots != null) {
        return restrictBots.call(this as UserPrivacySettingRuleRestrictBots);
      }
      break;
    case UserPrivacySettingRuleRestrictChatMembers.constructor:
      if (restrictChatMembers != null) {
        return restrictChatMembers.call(
          this as UserPrivacySettingRuleRestrictChatMembers,
        );
      }
      break;
    case UserPrivacySettingRuleRestrictContacts.constructor:
      if (restrictContacts != null) {
        return restrictContacts.call(
          this as UserPrivacySettingRuleRestrictContacts,
        );
      }
      break;
    case UserPrivacySettingRuleRestrictUsers.constructor:
      if (restrictUsers != null) {
        return restrictUsers.call(
          this as UserPrivacySettingRuleRestrictUsers,
        );
      }
      break;
  }
  return orElse.call();
}