CodeView class

Scrollable, selectable source-code viewer with async-safe highlighting.

Inheritance

Constructors

CodeView({required String code, Key? key, String? language, CodeHighlighter highlighter = const PlainTextCodeHighlighter(), TextStyle? style, bool wrap = false, bool selectable = true, bool showLineNumbers = true, TextStyle? lineNumberStyle, Color? selectionForegroundColor, Color? selectionBackgroundColor, FocusNode? focusNode, bool autofocus = false, void onSelectionChanged(SelectedText? selection)?, SelectionCopyCallback? onCopy, HighlightErrorCallback? onHighlightError, void onVisibleLineChanged(int line)?})
Configures source rendering, highlighting, gutter, and selection.
const

Properties

autofocus bool
Whether the view requests focus after mounting.
final
code String
Source code rendered verbatim.
final
focusNode FocusNode?
Caller-owned focus node, or null for widget ownership.
final
hashCode int
The hash code for this object.
no setterinherited
highlighter CodeHighlighter
Range producer; concrete grammar engines live outside Noir core.
final
key Key?
Controls how this widget replaces another of the same type.
finalinherited
language String?
Optional language identifier passed to highlighter.
final
lineNumberStyle TextStyle?
Source-line gutter style.
final
onCopy SelectionCopyCallback?
Receives each explicit Ctrl+C result.
final
onHighlightError HighlightErrorCallback?
Receives validation, synchronous, and asynchronous highlight failures.
final
onSelectionChanged → void Function(SelectedText? selection)?
Receives null when no non-empty selection remains.
final
onVisibleLineChanged → void Function(int line)?
Receives the first visible visual line after vertical scrolling.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectable bool
Whether text can be selected and explicitly copied.
final
selectionBackgroundColor Color?
Selected text background override.
final
selectionForegroundColor Color?
Selected text foreground override.
final
showLineNumbers bool
Whether source line numbers are shown.
final
style TextStyle?
Base source style.
final
wrap bool
Whether long source lines soft-wrap.
final

Methods

createState() State<CodeView>
Creates the mutable State for this widget.
override
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