source_parser 1.1.2 copy "source_parser: ^1.1.2" to clipboard
source_parser: ^1.1.2 copied to clipboard

discontinued

A project for parsing existing Dart code. You can then modify this parsed structure to modify any Dart source code.

example/example.dart

import 'package:source_parser/source_parser.dart';

void main() async {
  print ('First parse example:');
  print ('-------------------------');
  parse_string();
  print ('-------------------------\n');

  print ('Second parse example:');
  print ('-------------------------');
  parse_file_sync();
  print ('-------------------------\n');

  print ('Third parse example:');
  print ('-------------------------');
  await parse_file_async();
  print ('-------------------------\n');
}

// This parses this example file asynchronously and prints the parsed string (syntactically the same)
Future<void> parse_file_async() async {
  Parser parser = Parser();
  await parser.parse('example.dart');
  print (parser.toString().trim());
}

// This parses this example file sychronously and prints the parsed string (syntactically the same)
void parse_file_sync() {
  Parser parser = Parser()..parseSync('example.dart');
  print (parser.toString().trim());
}

// This parses a string sychronously and prints the parsed string (syntactically the same)
void parse_string() {
  Parser parser = Parser()..parseStr('class Test {}');
  print (parser.toString().trim());
}
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A project for parsing existing Dart code. You can then modify this parsed structure to modify any Dart source code.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

validators

More

Packages that depend on source_parser