Skip to content

Solutions in this repo

Dart

grammars/dart.json

The primary TextMate language grammar for Dart. This grammar is used by most editors and websites to provide syntax highlighting for Dart code.

It includes support for modern Dart features, including:

  • Dart 3.x: Patterns (switch expressions, if-case), Records, Class Modifiers (sealed, base, interface, final), and Extension Types.
  • Macros & Augmentations: Support for macro, augment, and augmented.

Used by:

Updating the Grammar

When updating the grammar, consider raising issues (or PRs) to update the following files which may not have automated updates from this repository:

Other solutions

These projects use different highlighting engines and maintain their own Dart grammars.

Tree-sitter

Tree-sitter is an incremental parsing system. There is no official tree-sitter grammar for Dart, but there are active community implementations:

highlight.js

highlight.js is a JavaScript-based syntax highlighter.

CodeMirror

CodeMirror is a web-based code editor.

PrismJS

Prism is a lightweight, extensible syntax highlighter.

About

Tools and documentation for how Dart code is formatted

Resources

Code of conduct

Contributing

Security policy

Stars

25 stars

Watchers

32 watching

Forks

Releases

Packages

Used by

Contributors

Languages