Leobit Lints
Lint rules for Dart and Flutter developed by Leobit.
Note: This package was inspired by Very Good Analysis.
Usage
To use the lints, add as a dev dependency in your pubspec.yaml
:
dev_dependencies:
leobit_lints: <latest-version>
Then, add an include in analysis_options.yaml
:
include: package:leobit_lints/leobit_lints.yaml
Custom Rules:
Here is the table of custom rules with information about them.
Name | From version | Description | Exceptions |
---|---|---|---|
avoid_bang_operator |
v0.1.0 | Forbids to use a bang operator ! as it may result in unexpected runtime exceptions. |
None. |
avoid_dynamic_type |
v0.4.0 | Forbids to use a dynamic keyword. |
dynamic is allowed inside Map<> for json serialization. |
avoid_late_keyword |
v0.1.0 | Forbids late keyword as it may result in unexpected runtime exceptions. |
late is allowed only with instant initializer. |
avoid_redundant_async |
v0.3.0 | Finds redundant async functions, method and keywords. |
Overridden methods and getters. |
avoid_widget_function |
v0.4.0 | Forbids return widget from getters, methods and functions, because it is anti-pattern in Flutter. Prefer extracting it to separate widget. | Overridden methods and getters. Allows to return Provider and subtypes. |
prefer_correct_dispose_order |
v0.5.0 | Forces developers to put super.dispose() calls in the end of method. Only for StatefulWidget . |
None. |
prefer_returning_condition |
v0.5.0 | Finds if-else statements with 'return' of boolean literal in both 'then' and 'else' statements. Proposes to return condition instead. | None. |
strict_double_literal |
v0.6.0 | Forces developers to remove redundant zeros from double literals. |
None. |
use_const_border |
v0.2.0 | Forces developers to use Border.fromBorderSide instead of Border.all , so const modifier can be added. |
Some of Border.all arguments are not const . |
use_const_border_radius |
v0.2.0 | Forces developers to use BorderRadius.all instead of BorderRadius.circular , so const modifier can be added. |
Some of BorderRadius.circular arguments are not const . |
use_list_view |
v0.3.0 | Forces developers to use ListView instead of SingleChildScrollView with nested Column |
None. |