maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult animation(
    1. InputInlineQueryResultAnimation value
    )?,
  2. TResult article(
    1. InputInlineQueryResultArticle value
    )?,
  3. TResult audio(
    1. InputInlineQueryResultAudio value
    )?,
  4. TResult contact(
    1. InputInlineQueryResultContact value
    )?,
  5. TResult document(
    1. InputInlineQueryResultDocument value
    )?,
  6. TResult game(
    1. InputInlineQueryResultGame value
    )?,
  7. TResult location(
    1. InputInlineQueryResultLocation value
    )?,
  8. TResult photo(
    1. InputInlineQueryResultPhoto value
    )?,
  9. TResult sticker(
    1. InputInlineQueryResultSticker value
    )?,
  10. TResult venue(
    1. InputInlineQueryResultVenue value
    )?,
  11. TResult video(
    1. InputInlineQueryResultVideo value
    )?,
  12. TResult voiceNote(
    1. InputInlineQueryResultVoiceNote value
    )?,
  13. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(InputInlineQueryResultAnimation value)? animation,
  TResult Function(InputInlineQueryResultArticle value)? article,
  TResult Function(InputInlineQueryResultAudio value)? audio,
  TResult Function(InputInlineQueryResultContact value)? contact,
  TResult Function(InputInlineQueryResultDocument value)? document,
  TResult Function(InputInlineQueryResultGame value)? game,
  TResult Function(InputInlineQueryResultLocation value)? location,
  TResult Function(InputInlineQueryResultPhoto value)? photo,
  TResult Function(InputInlineQueryResultSticker value)? sticker,
  TResult Function(InputInlineQueryResultVenue value)? venue,
  TResult Function(InputInlineQueryResultVideo value)? video,
  TResult Function(InputInlineQueryResultVoiceNote value)? voiceNote,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case InputInlineQueryResultAnimation.constructor:
      if (animation != null) {
        return animation.call(this as InputInlineQueryResultAnimation);
      }
      break;
    case InputInlineQueryResultArticle.constructor:
      if (article != null) {
        return article.call(this as InputInlineQueryResultArticle);
      }
      break;
    case InputInlineQueryResultAudio.constructor:
      if (audio != null) {
        return audio.call(this as InputInlineQueryResultAudio);
      }
      break;
    case InputInlineQueryResultContact.constructor:
      if (contact != null) {
        return contact.call(this as InputInlineQueryResultContact);
      }
      break;
    case InputInlineQueryResultDocument.constructor:
      if (document != null) {
        return document.call(this as InputInlineQueryResultDocument);
      }
      break;
    case InputInlineQueryResultGame.constructor:
      if (game != null) {
        return game.call(this as InputInlineQueryResultGame);
      }
      break;
    case InputInlineQueryResultLocation.constructor:
      if (location != null) {
        return location.call(this as InputInlineQueryResultLocation);
      }
      break;
    case InputInlineQueryResultPhoto.constructor:
      if (photo != null) {
        return photo.call(this as InputInlineQueryResultPhoto);
      }
      break;
    case InputInlineQueryResultSticker.constructor:
      if (sticker != null) {
        return sticker.call(this as InputInlineQueryResultSticker);
      }
      break;
    case InputInlineQueryResultVenue.constructor:
      if (venue != null) {
        return venue.call(this as InputInlineQueryResultVenue);
      }
      break;
    case InputInlineQueryResultVideo.constructor:
      if (video != null) {
        return video.call(this as InputInlineQueryResultVideo);
      }
      break;
    case InputInlineQueryResultVoiceNote.constructor:
      if (voiceNote != null) {
        return voiceNote.call(this as InputInlineQueryResultVoiceNote);
      }
      break;
  }
  return orElse.call();
}