This is an API designed to parse dart code and generate an intuitive tree for editing dart source code directly. It will open a text file (typically a .dart file) and parse it according to the dart grammar (v2.2).

NOTE: The format the parser outputs is syntactically the same as as any code parsed, but it will almost certainly change the format. It is not recommended to use this this parser to overwrite any files you may have written by hand (it will remove all comments).

Getting Started

The project is written in Dart, and can be imported as a standard Dart library. Thus, simply add it to your pubspec.yaml like so:

  source_parser: ^1.1.2

Then import it into whatever code you are using by importing:

import 'package:source_parser/source_parser.dart';


The only prerequisite should be Dart version >=2.2.0


This project is licensed under the BSD 3-Clause "New" or "Revised" License - see the file for details