maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult animation(
    1. InputChatPhotoAnimation value
    )?,
  2. TResult previous(
    1. InputChatPhotoPrevious value
    )?,
  3. TResult static(
    1. InputChatPhotoStatic value
    )?,
  4. TResult sticker(
    1. InputChatPhotoSticker value
    )?,
  5. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(InputChatPhotoAnimation value)? animation,
  TResult Function(InputChatPhotoPrevious value)? previous,
  TResult Function(InputChatPhotoStatic value)? static,
  TResult Function(InputChatPhotoSticker value)? sticker,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case InputChatPhotoAnimation.constructor:
      if (animation != null) {
        return animation.call(this as InputChatPhotoAnimation);
      }
      break;
    case InputChatPhotoPrevious.constructor:
      if (previous != null) {
        return previous.call(this as InputChatPhotoPrevious);
      }
      break;
    case InputChatPhotoStatic.constructor:
      if (static != null) {
        return static.call(this as InputChatPhotoStatic);
      }
      break;
    case InputChatPhotoSticker.constructor:
      if (sticker != null) {
        return sticker.call(this as InputChatPhotoSticker);
      }
      break;
  }
  return orElse.call();
}