dart_analysis_client 0.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 38

dart_analysis_client

Dart client library to access Dart analysis server

Usage

A simple usage example:

library main;

import 'dart:io';
import 'package:dart_analysis_client/dart_analysis_client.dart';

main() async {
  Directory dir = new Directory('C:\\Program Files\\Dart\\dart-sdk');
  if(!dir.existsSync()) {
    throw new Exception("Dart SDK dir does not exist!");
  }
  final config = new AnalyzerConfig(dir);

  final server = new AnalysisServer(config);
  await server.start();
  print((await server.getVersion()).toJson());
  exit(0);
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.1

  • Initial version, created by Stagehand

example/example.dart

// Copyright (c) 2017, Ravi Teja Gudapati. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library main;

import 'dart:io';
import 'package:dart_analysis_client/dart_analysis_client.dart';

const folders = const <String>[
  r'C:\Users\seragud\dart\icu\dart_analysis_client\example\data\project1\lib\src\'
];
const file =
    r'C:\Users\seragud\dart\icu\dart_analysis_client\example\data\project1\lib\src\project1_base.dart';

main() async {
  Directory dir = new Directory(r'C:\Program Files\Dart\dart-sdk');
  if (!dir.existsSync()) {
    throw new Exception("Dart SDK dir does not exist!");
  }
  final config = new AnalyzerConfig(dir);

  final server = new AnalysisServer(config);
  await server.start();

  // print version
  print((await server.getVersion()).toJson());

  // add dart files
  await server.setProjectRoots(folders);

  // add dart files
  GetNavigationResult nav = await server.getNavigation(file, 16, 30);

  GetSuggestionResult suggestions = await server.getSuggestions(file, 284);

  // print version
  print((await server.getVersion()).toJson());

  exit(0);
}

1. Depend on it

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


dependencies:
  dart_analysis_client: "^0.0.3"

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 packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_analysis_client/dart_analysis_client.dart';
        
Version Uploaded Documentation Archive
0.0.3 Jan 29, 2017 Go to the documentation of dart_analysis_client 0.0.3 Download dart_analysis_client 0.0.3 archive
0.0.2 Jan 27, 2017 Go to the documentation of dart_analysis_client 0.0.2 Download dart_analysis_client 0.0.2 archive
0.0.1 Jan 27, 2017 Go to the documentation of dart_analysis_client 0.0.1 Download dart_analysis_client 0.0.1 archive

Analysis

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

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: Flutter, other

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

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 errors 4 hints.

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

    line: 150 col: 18
    The function expression type '(Map<dynamic, dynamic>) → AnalysisError' isn't of type '(dynamic) → AnalysisError'. This means its parameter or return type does not match what is expected. Consider changing parameter type(s) or the returned type(s).

    Strong-mode analysis of lib/src/dart_analysis_client_base.dart gave the following hint:

    line: 80 col: 19
    'JSON' is deprecated and shouldn't be used.

  • 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.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
logging >=0.11.3+1 <0.12.0 0.11.3+1
path >=1.4.1 <2.0.0 1.5.1
Dev dependencies
test >=0.12.0 <0.13.0