maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult animation(
    1. InlineQueryResultAnimation value
    )?,
  2. TResult article(
    1. InlineQueryResultArticle value
    )?,
  3. TResult audio(
    1. InlineQueryResultAudio value
    )?,
  4. TResult contact(
    1. InlineQueryResultContact value
    )?,
  5. TResult document(
    1. InlineQueryResultDocument value
    )?,
  6. TResult game(
    1. InlineQueryResultGame value
    )?,
  7. TResult location(
    1. InlineQueryResultLocation value
    )?,
  8. TResult photo(
    1. InlineQueryResultPhoto value
    )?,
  9. TResult sticker(
    1. InlineQueryResultSticker value
    )?,
  10. TResult venue(
    1. InlineQueryResultVenue value
    )?,
  11. TResult video(
    1. InlineQueryResultVideo value
    )?,
  12. TResult voiceNote(
    1. InlineQueryResultVoiceNote value
    )?,
  13. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(InlineQueryResultAnimation value)? animation,
  TResult Function(InlineQueryResultArticle value)? article,
  TResult Function(InlineQueryResultAudio value)? audio,
  TResult Function(InlineQueryResultContact value)? contact,
  TResult Function(InlineQueryResultDocument value)? document,
  TResult Function(InlineQueryResultGame value)? game,
  TResult Function(InlineQueryResultLocation value)? location,
  TResult Function(InlineQueryResultPhoto value)? photo,
  TResult Function(InlineQueryResultSticker value)? sticker,
  TResult Function(InlineQueryResultVenue value)? venue,
  TResult Function(InlineQueryResultVideo value)? video,
  TResult Function(InlineQueryResultVoiceNote value)? voiceNote,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case InlineQueryResultAnimation.constructor:
      if (animation != null) {
        return animation.call(this as InlineQueryResultAnimation);
      }
      break;
    case InlineQueryResultArticle.constructor:
      if (article != null) {
        return article.call(this as InlineQueryResultArticle);
      }
      break;
    case InlineQueryResultAudio.constructor:
      if (audio != null) {
        return audio.call(this as InlineQueryResultAudio);
      }
      break;
    case InlineQueryResultContact.constructor:
      if (contact != null) {
        return contact.call(this as InlineQueryResultContact);
      }
      break;
    case InlineQueryResultDocument.constructor:
      if (document != null) {
        return document.call(this as InlineQueryResultDocument);
      }
      break;
    case InlineQueryResultGame.constructor:
      if (game != null) {
        return game.call(this as InlineQueryResultGame);
      }
      break;
    case InlineQueryResultLocation.constructor:
      if (location != null) {
        return location.call(this as InlineQueryResultLocation);
      }
      break;
    case InlineQueryResultPhoto.constructor:
      if (photo != null) {
        return photo.call(this as InlineQueryResultPhoto);
      }
      break;
    case InlineQueryResultSticker.constructor:
      if (sticker != null) {
        return sticker.call(this as InlineQueryResultSticker);
      }
      break;
    case InlineQueryResultVenue.constructor:
      if (venue != null) {
        return venue.call(this as InlineQueryResultVenue);
      }
      break;
    case InlineQueryResultVideo.constructor:
      if (video != null) {
        return video.call(this as InlineQueryResultVideo);
      }
      break;
    case InlineQueryResultVoiceNote.constructor:
      if (voiceNote != null) {
        return voiceNote.call(this as InlineQueryResultVoiceNote);
      }
      break;
  }
  return orElse.call();
}