resolver 0.1.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 10

resolver

package:resolver

WARNING: This is not an official Google or Dart project

A very simple frontend for resolving Dart code using package:analyzer. As the API for using these mostly Dart-internal packages improves, this package will become obsolete.

Until then, it exists to help new and experienced Dart developers alike get started with tooling they want to write that requires a resolved AST (i.e. with types, imports, metadata available).

This package is not meant to be used to do source/code generation - you should look at package:source_gen or the lower-level package:build, which already has a very simplified model for resolving code.

Getting Started

This package is meant to be used along with package:analyzer, so you'll likely want to import both packages when writing a tool. So, for a quick-start example:

import 'package:analyzer/analyzer.dart';
import 'package:resolver/resolver.dart';

main() async {
  final resolver = new Resolver();
  final library = await resolver.resolveAbsoluteUri('local/file.dart');
  ...
}

To be able to resolve files that include package:, use forPackage:

import 'package:analyzer/analyzer.dart';
import 'package:resolver/resolver.dart';

main() async {
  final resolver = new Resolver.forPackage('local/path/package');
  final library = await resolver.resolvePackageUri(
    'package', 
    'file.dart',
  );
  ...
}

0.1.1

  • Added Resolver#resolveSourceCode(dartSourceCode)

0.1.0

  • Initial commit

Use this package as a library

1. Depend on it

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


dependencies:
  resolver: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:resolver/resolver.dart';
  
Version Uploaded Documentation Archive
0.1.1 Dec 20, 2016 Go to the documentation of resolver 0.1.1 Download resolver 0.1.1 archive
0.1.0 Dec 20, 2016 Go to the documentation of resolver 0.1.0 Download resolver 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
21
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
10
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0 <2.0.0