OutputFormatPatterns extension

Adds pattern-matching-related methods to OutputFormat.

on

Methods

map<TResult extends Object?>({required TResult plain(OutputFormat_Plain value), required TResult markdown(OutputFormat_Markdown value), required TResult djot(OutputFormat_Djot value), required TResult html(OutputFormat_Html value), required TResult json(OutputFormat_Json value), required TResult docTags(OutputFormat_DocTags value), required TResult custom(OutputFormat_Custom value)}) → TResult

Available on OutputFormat, provided by the OutputFormatPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({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)?}) → TResult?

Available on OutputFormat, provided by the OutputFormatPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({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()}) → TResult

Available on OutputFormat, provided by the OutputFormatPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult plain()?, TResult markdown()?, TResult djot()?, TResult html()?, TResult json()?, TResult docTags()?, TResult custom(String field0)?, required TResult orElse()}) → TResult

Available on OutputFormat, provided by the OutputFormatPatterns extension

A variant of when that fallback to an orElse callback.
when<TResult extends Object?>({required TResult plain(), required TResult markdown(), required TResult djot(), required TResult html(), required TResult json(), required TResult docTags(), required TResult custom(String field0)}) → TResult

Available on OutputFormat, provided by the OutputFormatPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? plain()?, TResult? markdown()?, TResult? djot()?, TResult? html()?, TResult? json()?, TResult? docTags()?, TResult? custom(String field0)?}) → TResult?

Available on OutputFormat, provided by the OutputFormatPatterns extension

A variant of when that fallback to returning null