Skip to content
pubscout

val_highlight

0.1.1, released 5 weeks ago by useval.io

Syntax highlighter in pure Dart for 55 languages, themes, incremental updates, and HTML output.

WASM-ready
$ flutter pub add val_highlight
Source repository

What it does

Provides syntax highlighting for 55 languages in pure Dart with no native code, WebView, or JavaScript dependencies. Includes incremental updates, pre-built themes, VS Code theme import, and HTML output for text rendering.

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

Use it when

  • You need to highlight code snippets or render syntax-highlighted code in pure Dart across any platform.
  • You want incremental updates for a code editor experience.
  • You want to import VS Code themes into a Dart application.

Skip it when

  • You are looking for pre-built Flutter code editor widgets like CodeView or CodeField (use val_highlight_flutter instead).

Strengths

  • Pure Dart with no native or JS dependencies, running on every platform.
  • Incremental updating designed for editors, scanning only affected lines.
  • Supports 55 languages and includes VS Code theme import.
  • Fast linear-time performance.

Weaknesses

  • Does not include Flutter-specific widgets out of the box (requires val_highlight_flutter for that).
  • Writing custom grammars from scratch can be complex.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:val_highlight/val_highlight.dart';
import 'package:val_highlight/languages/dart.dart';

final html = const Highlighter().toHtml(source, language: dartLanguage);

Alternatives

Packages that do the same job and could replace val_highlight.

Works with

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