PrismMarkdown class
A widget that renders markdown text as rich, selectable Flutter UI.
Supports the full CommonMark spec plus GFM extensions: tables, strikethrough, task lists, and autolinks. No web views, no platform plugins — pure Flutter rendering.
PrismMarkdown('# Hello\n\nWorld with **bold** text.')
This is a pure-Flutter widget with no platform channels, so it works on every Flutter platform: Android, iOS, macOS, Windows, Linux, and web.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PrismMarkdown
Constructors
-
PrismMarkdown(String data, {Key? key, PrismMarkdownStyle? style, ExtensionSet? extensionSet, void onLinkTap(String href)?, bool selectable = true, TextSpan highlighter(String code, String language)?, Widget imageBuilder(String src, String alt, Widget fallback)?, int? maxLines, TextOverflow? overflow, bool asyncParsing = false, Widget? placeholder, Future<
List< parseRunner(String data, ExtensionSet? extensionSet)?})Node> > -
Creates a markdown renderer.
const
Properties
- asyncParsing → bool
-
Whether to parse the markdown off the UI thread in a background
isolate.
final
- data → String
-
The markdown source to render.
final
- extensionSet → ExtensionSet?
-
Markdown extension set applied during parsing. Defaults to
md.ExtensionSet.gitHubWeb when null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlighter → TextSpan Function(String code, String language)?
-
Custom syntax highlighter for fenced code blocks.
final
- imageBuilder → Widget Function(String src, String alt, Widget fallback)?
-
Custom builder for inline images (
).final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxLines → int?
-
Maximum number of lines a text block (heading, paragraph, list item, or
table cell) may occupy before being truncated.
final
- onLinkTap → void Function(String href)?
-
Called when a link is tapped.
final
- overflow → TextOverflow?
-
How visual overflow of truncated text should be handled.
final
-
parseRunner
→ Future<
List< Function(String data, ExtensionSet? extensionSet)?Node> > -
Overrides the async parse executor. Null by default, in which case
parsing runs in a background isolate via Isolate.run.
final
- placeholder → Widget?
-
Widget shown while async parsing is in progress.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectable → bool
-
Whether text can be selected.
final
- style → PrismMarkdownStyle?
-
Visual styling. Unset fields are derived from the ambient ThemeData.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PrismMarkdown> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited