source_transformer 0.1.1

  • Installing
  • Versions
  • 37


NOTE: This project is not an official Google or dart-lang project

This package is currently in development

Not to be confused with code_transformers or source_gen, source_transformer is a library for building and applying modifications to existing files, primarily .dart source files, and to commit the results of those changes.

Example uses:

  • Writing tools to automatically upgrade deprecated APIs
  • Writing tools to perform mass refactorings
  • Writing tools to perform macros as part of writing new code

An example of creating a binary that removes duplicate imports/exports:

import 'package:source_transformer/source_transformer.dart';

main(List<String> paths) async {
  await runTransformer(const DeduplicateDirectives(), paths);


  • Added RemovePatterns and ReplacePatterns


  • Initial Commit

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  source_transformer: "^0.1.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:source_transformer/source_transformer.dart';
Version Uploaded Documentation Archive
0.1.1 Dec 20, 2016 Go to the documentation of source_transformer 0.1.1 Download source_transformer 0.1.1 archive
0.1.0 Dec 19, 2016 Go to the documentation of source_transformer 0.1.0 Download source_transformer 0.1.0 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
89 / 100
Reflects how tidy and up-to-date the package is. [more]
51 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

Primary library: package:source_transformer/source_transformer.dart with components: io.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors 11 hints.

    Strong-mode analysis of lib/src/dart/directives.dart failed with the following error:

    line: 117 col: 11
    The setter 'uri' isn't defined for the class 'Directive'.

    Strong-mode analysis of lib/src/transformer.dart failed with the following error:

    line: 71 col: 12
    The return type 'Future<Future<SourceFile>>' isn't a 'Future<SourceFile>', as defined by the method 'transform'.

    Similar analysis of the following files failed:

    • lib/src/cli.dart (hint)
    • lib/src/patterns.dart (hint)
    • lib/src/utils.dart (hint)
  • Package is getting outdated.

    The package was released 77 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use source_transformer.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
analyzer >=0.29.1 <0.30.0 0.29.11 0.32.1
collection ^1.11.0 1.14.10
meta ^1.0.3 1.1.5
quiver >=0.22.0 <0.30.0 0.29.0+1
source_span ^1.0.0 1.4.0
Transitive dependencies
args 0.13.7 1.4.3
async 2.0.7
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
convert 2.0.1
crypto 2.0.3
csslib 0.14.4
glob 1.1.5
html 0.13.3+1
isolate 1.1.0 2.0.1
logging 0.11.3+1
matcher 0.12.2+1
package_config 1.0.3
path 1.6.0
plugin 0.2.0+2
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+8
when 0.2.0
which 0.1.3
yaml 2.1.14
Dev dependencies
test ^0.12.17