SyntaxHighlighter class abstract interface

Turns the text of a fenced code block into styled InlineSpans.

Assign an instance to MarkdownThemeData.highlighter to enable syntax highlighting. The default (no highlighter) paints code as plain text.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

backgroundFor(String? language) Color?
The background color to use for language's code block, or null to keep the ambient surface color.
baseStyleFor(String? language, TextStyle fallback) TextStyle
The base style for language's code, derived from fallback (the code block's monospace style). Used to apply the theme's default foreground so untokenized code stays legible on the theme background.
highlight(String code, String? language, TextStyle baseStyle) List<InlineSpan>
Returns the spans for code, tagged for language. Implementations must preserve text exactly: the concatenation of the returned spans' text must equal code, so selection and copy stay aligned. baseStyle is the code block's base (monospace) style, already applied to the enclosing span.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited