maybeMap<TResult extends Object?> method

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

Implementation

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