linter 0.1.30-alpha.1

  • Installing
  • Versions
  • 89

Linter for Dart

A Dart style linter.

Build Status Build status Coverage Status Pub


The easiest way to install the linter is to globally activate it via pub:

$ pub global activate linter

Alternatively, clone the linter repo like this:

$ git clone


Linter for Dart gives you feedback to help you keep your code in line with the published Dart Style Guide. Currently enforced lint rules (or "lints") are catalogued here. When you run the linter all lints are enabled but don't worry, configuration, wherein you can specifically enable/disable lints, is in the works. While initial focus is on style lints, other lints that catch common programming errors are certainly of interest. If you have ideas, please file a feature request.

Running the linter via pub looks like this:

$ pub global run linter my_project

With example output will looking like this:

my_project/my_library.dart 13:8 [lint] Name non-constant identifiers using lowerCamelCase.
  IOSink std_err = stderr;
12 files analyzed, 1 issue found.

Supported options are

-h, --help                             Shows usage information.
-s, --stats                            Show lint statistics.
    --[no-]visit-transitive-closure    Visit the transitive closure of imported/exported libraries.
-q, --[no-]quiet                       Don't show individual lint errors.
-c, --config                           Use configuration from this file.
    --dart-sdk                         Custom path to a Dart SDK.
-p, --package-root                     Custom package root. (Discouraged.)

Note that you should not need to specify an sdk or package-root. Lint configuration file format is provisional and under active discussion. Other configuration options are on the way.


Feedback is, of course, greatly appreciated and contributions are welcome! Please read the contribution guidelines.

Features and bugs

Please file feature requests and bugs at the issue tracker.


  • New cascade_invocations lint.
  • Expand await_only_futures to accept classes that extend or implement Future.
  • Improve camel case regular expression tests to accept $s.
  • Fixes to parameter_assignments (improved getter handling and an NPE).


  • Fixed cast exception in dart_type_utilities (dart-lang/sdk#27405).
  • New parameter_assignments lint.
  • New prefer_final_fields lint.
  • New prefer_final_locals lint.
  • Markdown link fixes in docs (#306).
  • Miscellaneous solo test running fixes and introduction of solo_debug (#304).


  • Updated tests to use package test (#302).


  • Fixed false positive on []= in always_declare_return_types (#300).
  • New invariant_booleans lint.
  • New literal_only_boolean_expressions lint.
  • Fixed camel_case_types to allow $ in identifiers (#290).


  • Internal updates to keep up with changes in the analyzer package.
  • Updated close_sinks to respect calls to destroy (#282).
  • Fixed only_throw_errors to report on the expression not node.


  • Removed whitespace_around_ops pending re-name and re-design (#249).


  • Grinder support (rule:rule_name and docs:location) for rule stub and doc generation (respectively).
  • Fix to allow leading underscores in non_constant_identifier_names.
  • New valid_regexps lint (#277).
  • New whitespace_around_ops lint (#249).
  • Fix to overridden_fields to flag overridden static fields (#274).
  • New list_remove_unrelated_type to detect passing a non-T value to `List.remove()`` (#271).
  • New empty_catches lint to catch empty catch blocks (#43).
  • Fixed close_sinks false positive (#268).
  • linter support for --strong to allow for running linter in strong mode.


  • New only_throw_errors lint.
  • New lint to check for empty_statements (#259).
  • Fixed NSME when file contents cannot be read (#260).
  • Fixed unsafe cast in iterable_contains_unrelated_type (#267).


  • New cancel_subscriptions lint.


  • New close_sinks lint.
  • Fixes to iterable_contains_unrelated_type.


  • Fix NSME in iterable_contains_unrelated_type (#245).
  • Fixed typo in comment_references error description.
  • Fix overriden_field false positive (#246).
  • Rename linter binary lints option to rules (#248).
  • Help doc tweaks.


  • Fix to public_member_api_docs to check for documented getters when checking setters (#237).
  • New iterable_contains_unrelated_type lint to detect when Iterable.contains is invoked with an object of an unrelated type.
  • New comment_references lint to ensure identifiers referenced in docs are in scope (#240).


  • Fix for false positive in overriden_fields.
  • New unrelated_type_equality_checks lint.
  • Fix to accept $ identifiers in string interpolation lint (#214).
  • Update to new plugin API (0.2.0).
  • Strong mode cleanup.


  • Fix to allow simple getter/setters when a decl is ``@protected` (#215).
  • Fix to not require type params in is checks (#227).
  • Fix to not flag field formal identifiers in parameters (#224).
  • Fix to respect filters when calculating error codes (#198).
  • Fix to allow const and final vars to be initialized to null (#210).
  • Fix to respect commented blocks in empty_constructor_bodies (#209).
  • Fix to check types on list/map literals (#199).
  • Fix to skip main when checking for API docs (#207).
  • Fix to allow leading $ in type names (#220).
  • Fix to ignore private typedefs when checking for types (#216).
  • New test_types_in_equals lint.
  • New await_only_futures lint.
  • New throw_in_finally lint.
  • New control_flow_in_finally lint.


  • Fix to respect @optionalTypeArgs (#196).
  • Lint to warn if a field overrides or hides other field.
  • Fix to allow single char UPPER_CASE non-constants (#201).
  • Fix to accept casts to dynamic (#195).


  • Fix to skip overriding members in API doc checks (public_member_api_docs).
  • Fix to suppress lints on synthetic nodes/tokens (#193).
  • Message fixes (annotate_overrides, public_member_api_docs).
  • Fix to exclude setters from return type checks (#192).


  • Fix to address LibraryNames regexp that in pathological cases went exponential.


  • Doc generation improvements (now with options samples).
  • Lint to sort unnamed constructors first (#187).
  • Lint to ensure public members have API docs (#188).
  • Lint to ensure constructors are sorted first (#186).
  • Lint for hashCode and == (#168).
  • Lint to detect un-annotated overrides (#167).
  • Fix to ignore underscores in public APIs (#153).
  • Lint to check for return types on setters (#122).
  • Lint to flag missing type params (#156).
  • Lint to avoid inits to null (#160).


  • Updated to use analyzer 0.27.0.
  • Updated options processing to handle untyped maps (dart-lang/sdk#25126).


  • Fix type_annotate_public_apis to properly handle getters/setters (#151; dart-lang/sdk#25092).


  • Fix to protect against errors in linting invalid source (dart-lang/sdk#24910).
  • Added avoid_empty_else lint rule (dart-lang/sdk#224936).


  • Fix to package_api_docs (dart-lang/sdk#24947; #154).


  • Fix to package_prefixed_library_names (dart-lang/sdk#24947; #154).


  • Added prefer_is_not_empty lint rule (#143).
  • Added type_annotate_public_apis lint rule (#24).
  • Added avoid_as lint rule (#145).
  • Fixed non_constant_identifier_names rule to special case underscore identifiers in callbacks.
  • Fix to escape _s in callback type validation (addresses false positives in always_specify_types) (#147).


  • Added always_declare_return_types lint rule (#146).
  • Improved always_specify_types to detect missing types in declared identifiers and narrowed source range to the token.
  • Added implementation_imports lint rule (#33).
  • Test performance improvements.


  • Added always_specify_types lint rule (#144).


  • Fixed linter registry memory leaks.


  • Fixed various options file parsing issues.


  • Fixed false positives in unnecessary_brace_in_string_interp lint. Fix #112.


  • Internal code and dependency constraint cleanup.


  • Initial stable release.


  • Added machine output option. Fix #69.
  • Fixed resolution of files in lib/ to use a package: URI. Fix #49.
  • Tightened up analyzer package constraints.
  • Fixed false positives in one_member_abstracts lint. Fix #64.


  • Initial push to pub.

1. Depend on it

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

  linter: "^0.1.30-alpha.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 packages get. Check the docs for your editor to learn more.

Version Uploaded Documentation Archive
0.1.48 Apr 16, 2018 Go to the documentation of linter 0.1.48 Download linter 0.1.48 archive
0.1.47 Apr 6, 2018 Go to the documentation of linter 0.1.47 Download linter 0.1.47 archive
0.1.46 Mar 26, 2018 Go to the documentation of linter 0.1.46 Download linter 0.1.46 archive
0.1.45 Mar 20, 2018 Go to the documentation of linter 0.1.45 Download linter 0.1.45 archive
0.1.44 Mar 13, 2018 Go to the documentation of linter 0.1.44 Download linter 0.1.44 archive
0.1.43 Feb 7, 2018 Go to the documentation of linter 0.1.43 Download linter 0.1.43 archive
0.1.42 Jan 11, 2018 Go to the documentation of linter 0.1.42 Download linter 0.1.42 archive
0.1.41 Dec 14, 2017 Go to the documentation of linter 0.1.41 Download linter 0.1.41 archive
0.1.40 Dec 1, 2017 Go to the documentation of linter 0.1.40 Download linter 0.1.40 archive
0.1.39 Nov 2, 2017 Go to the documentation of linter 0.1.39 Download linter 0.1.39 archive

All 55 versions...


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

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


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


Detected platforms: Flutter, web, other

No platform restriction found in libraries.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors 1 hint.

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

    line: 82 col: 19
    The getter 'name' isn't defined for the class 'TypeAnnotation'.

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

    line: 28 col: 9
    The argument type 'LinkedHashSet' can't be assigned to the parameter type 'HashSet<Expression>'.

  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

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

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use linter.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0
analyzer 0.30.0-alpha.1 0.30.0-alpha.1 0.31.1
args >=0.12.1 <0.14.0 0.13.7 1.4.1
cli_util ^0.0.1 0.0.1+2 0.1.2+1
glob ^1.0.3 1.1.5
plugin ^0.2.0 0.2.0+2
source_span ^1.0.2 1.4.0
yaml ^2.1.2 2.1.13
Transitive dependencies
async 2.0.6
charcode 1.1.1
collection 1.14.9
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
front_end 0.1.0-alpha.1 0.1.0-alpha.11
html 0.13.3
isolate 1.1.0 2.0.0
logging 0.11.3+1
meta 1.1.2
package_config 1.0.3
path 1.5.1
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
when 0.2.0
which 0.1.3
Dev dependencies
grinder ^0.8.0
markdown ^0.11.0
matcher ^0.12.0
mockito ^1.0.0
test ^0.12.0