maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult epic(
    1. UpgradedGiftAttributeRarityEpic value
    )?,
  2. TResult legendary(
    1. UpgradedGiftAttributeRarityLegendary value
    )?,
  3. TResult perMille(
    1. UpgradedGiftAttributeRarityPerMille value
    )?,
  4. TResult rare(
    1. UpgradedGiftAttributeRarityRare value
    )?,
  5. TResult uncommon(
    1. UpgradedGiftAttributeRarityUncommon value
    )?,
  6. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(UpgradedGiftAttributeRarityEpic value)? epic,
  TResult Function(UpgradedGiftAttributeRarityLegendary value)? legendary,
  TResult Function(UpgradedGiftAttributeRarityPerMille value)? perMille,
  TResult Function(UpgradedGiftAttributeRarityRare value)? rare,
  TResult Function(UpgradedGiftAttributeRarityUncommon value)? uncommon,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case UpgradedGiftAttributeRarityEpic.constructor:
      if (epic != null) {
        return epic.call(this as UpgradedGiftAttributeRarityEpic);
      }
      break;
    case UpgradedGiftAttributeRarityLegendary.constructor:
      if (legendary != null) {
        return legendary.call(this as UpgradedGiftAttributeRarityLegendary);
      }
      break;
    case UpgradedGiftAttributeRarityPerMille.constructor:
      if (perMille != null) {
        return perMille.call(this as UpgradedGiftAttributeRarityPerMille);
      }
      break;
    case UpgradedGiftAttributeRarityRare.constructor:
      if (rare != null) {
        return rare.call(this as UpgradedGiftAttributeRarityRare);
      }
      break;
    case UpgradedGiftAttributeRarityUncommon.constructor:
      if (uncommon != null) {
        return uncommon.call(this as UpgradedGiftAttributeRarityUncommon);
      }
      break;
  }
  return orElse.call();
}