maybeMap<TResult extends Object?> method
- @optionalTypeArgs
- TResult plain(
- OutputFormat_Plain value
- TResult markdown(
- OutputFormat_Markdown value
- TResult djot(
- OutputFormat_Djot value
- TResult html(
- OutputFormat_Html value
- TResult json(
- OutputFormat_Json value
- TResult docTags(
- OutputFormat_DocTags value
- TResult custom(
- OutputFormat_Custom 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( OutputFormat_Plain value)? plain,TResult Function( OutputFormat_Markdown value)? markdown,TResult Function( OutputFormat_Djot value)? djot,TResult Function( OutputFormat_Html value)? html,TResult Function( OutputFormat_Json value)? json,TResult Function( OutputFormat_DocTags value)? docTags,TResult Function( OutputFormat_Custom value)? custom,required TResult orElse(),}){
final _that = this;
switch (_that) {
case OutputFormat_Plain() when plain != null:
return plain(_that);case OutputFormat_Markdown() when markdown != null:
return markdown(_that);case OutputFormat_Djot() when djot != null:
return djot(_that);case OutputFormat_Html() when html != null:
return html(_that);case OutputFormat_Json() when json != null:
return json(_that);case OutputFormat_DocTags() when docTags != null:
return docTags(_that);case OutputFormat_Custom() when custom != null:
return custom(_that);case _:
return orElse();
}
}