StyleChecker class final

Runs style rules over Dart source.

It is also the way to test a custom rule:

final violations = StyleChecker([const NoPrintRule()])
    .checkSource('lib/a.dart', "void f() => print('x');");
expect(violations.single.ruleId, 'no_print');

Constructors

StyleChecker(List<StyleRule> rules)
Creates a checker running rules.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
rules → List<StyleRule>
The rules to run.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkSource(String path, String content) → List<StyleViolation>
Parses content, the text of the file at path relative to the package root, and runs every rule on it. Violations suppressed by an // inspectra: ignore-style comment are left out.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited