maybeMap<TResult extends Object?> method
- @optionalTypeArgs
- TResult paragraph(
- InputRichBlockParagraph value
- TResult heading(
- InputRichBlockSectionHeading value
- TResult pre(
- InputRichBlockPreformatted value
- TResult divider(
- InputRichBlockDivider value
- TResult mathematicalExpression(
- InputRichBlockMathematicalExpression value
- TResult anchor(
- InputRichBlockAnchor value
- TResult list(
- InputRichBlockList value
- TResult blockquote(
- InputRichBlockBlockQuotation value
- TResult pullquote(
- InputRichBlockPullQuotation value
- TResult collage(
- InputRichBlockCollage value
- TResult slideshow(
- InputRichBlockSlideshow value
- TResult table(
- InputRichBlockTable value
- TResult details(
- InputRichBlockDetails value
- TResult map(
- InputRichBlockMap value
- TResult animation(
- InputRichBlockAnimation value
- TResult audio(
- InputRichBlockAudio value
- TResult photo(
- InputRichBlockPhoto value
- TResult video(
- InputRichBlockVideo value
- TResult voiceNote(
- InputRichBlockVoiceNote value
- TResult thinking(
- InputRichBlockThinking value
- required TResult orElse(),
A variant of map that fallback to returning orElse.
It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case _:
return orElse();
}
Implementation
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(InputRichBlockParagraph value)? paragraph,
TResult Function(InputRichBlockSectionHeading value)? heading,
TResult Function(InputRichBlockPreformatted value)? pre,
TResult Function(InputRichBlockFooter value)? footer,
TResult Function(InputRichBlockDivider value)? divider,
TResult Function(InputRichBlockMathematicalExpression value)?
mathematicalExpression,
TResult Function(InputRichBlockAnchor value)? anchor,
TResult Function(InputRichBlockList value)? list,
TResult Function(InputRichBlockBlockQuotation value)? blockquote,
TResult Function(InputRichBlockPullQuotation value)? pullquote,
TResult Function(InputRichBlockCollage value)? collage,
TResult Function(InputRichBlockSlideshow value)? slideshow,
TResult Function(InputRichBlockTable value)? table,
TResult Function(InputRichBlockDetails value)? details,
TResult Function(InputRichBlockMap value)? map,
TResult Function(InputRichBlockAnimation value)? animation,
TResult Function(InputRichBlockAudio value)? audio,
TResult Function(InputRichBlockPhoto value)? photo,
TResult Function(InputRichBlockVideo value)? video,
TResult Function(InputRichBlockVoiceNote value)? voiceNote,
TResult Function(InputRichBlockThinking value)? thinking,
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case InputRichBlockParagraph() when paragraph != null:
return paragraph(_that);
case InputRichBlockSectionHeading() when heading != null:
return heading(_that);
case InputRichBlockPreformatted() when pre != null:
return pre(_that);
case InputRichBlockFooter() when footer != null:
return footer(_that);
case InputRichBlockDivider() when divider != null:
return divider(_that);
case InputRichBlockMathematicalExpression()
when mathematicalExpression != null:
return mathematicalExpression(_that);
case InputRichBlockAnchor() when anchor != null:
return anchor(_that);
case InputRichBlockList() when list != null:
return list(_that);
case InputRichBlockBlockQuotation() when blockquote != null:
return blockquote(_that);
case InputRichBlockPullQuotation() when pullquote != null:
return pullquote(_that);
case InputRichBlockCollage() when collage != null:
return collage(_that);
case InputRichBlockSlideshow() when slideshow != null:
return slideshow(_that);
case InputRichBlockTable() when table != null:
return table(_that);
case InputRichBlockDetails() when details != null:
return details(_that);
case InputRichBlockMap() when map != null:
return map(_that);
case InputRichBlockAnimation() when animation != null:
return animation(_that);
case InputRichBlockAudio() when audio != null:
return audio(_that);
case InputRichBlockPhoto() when photo != null:
return photo(_that);
case InputRichBlockVideo() when video != null:
return video(_that);
case InputRichBlockVoiceNote() when voiceNote != null:
return voiceNote(_that);
case InputRichBlockThinking() when thinking != null:
return thinking(_that);
case _:
return orElse();
}
}