Skip to content
pubscout

flutter_syntax_view

4.1.7, released 2 years ago by an unverified publisher

A static syntax highlighter widget for Flutter supporting multiple programming languages.

WASM-ready
$ flutter pub add flutter_syntax_view
Source repository

What it does

Provides a static syntax highlighter widget that displays code text highlighted according to programming language syntax using native Dart code. It supports multiple built-in languages, custom themes, line numbers, and zoom controls.

AI-written summary of version 4.1.7, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display static snippets of source code inside a Flutter app.
  • You want support for multiple languages like Dart, C++, Java, Python, Rust, and JavaScript out of the box.
  • You need line numbering and text selection for displayed code blocks.

Skip it when

  • You need a fully-featured code editor with syntax-highlighted typing capabilities.
  • You need support for programming languages not included in the package's supported syntax list.

Strengths

  • Supports multiple programming languages (Dart, C, C++, Java, Kotlin, Swift, JavaScript, YAML, Rust, Lua, Python).
  • Comes with built-in themes and allows custom syntax theme configurations.
  • Includes features like line counts, zoom icon controls, and text selection.

Weaknesses

  • Not a fully interactive code editor; it is designed for static viewing.
  • Limited to the built-in language parsers provided via regular expressions.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
SyntaxView(
    code: code,
    syntax: Syntax.DART,
    syntaxTheme: SyntaxTheme.vscodeDark(),
    fontSize: 12.0,
    withZoom: true,
    withLinesCount: true,
    expanded: false,
    selectable: true
)

Alternatives

Packages that do the same job and could replace flutter_syntax_view.

  • re_editor

    A lightweight text and code editor widget for Flutter with syntax highlighting and folding.

  • val_highlight_flutter

    Flutter widgets for displaying and editing syntax-highlighted code.

  • re_highlight

    Powerful text syntax highlighting library translated from highlightjs.

  • code_forge

    A powerful text editor widget for Flutter handling 1M+ lines with LSP and AI completion.

Works with

Packages commonly used together with flutter_syntax_view: ones it builds on, ones built on it, and its own family.