leobit_lints 0.9.1

SDKdartflutter
Platformandroidioswindowslinuxmacos

Lints for Dart and Flutter with some custom rules from Leobit

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

Or you can include lints from dart library only (same as leobit_lints.yaml, but without custom ones):

include: package:leobit_lints/standard_lints_only.yaml

Custom Rules:

Here is the table of custom rules with information about them.

NameVersionDescriptionExceptions
avoid_bang_operatorv0.1.0Forbids to use a bang operator ! as it may result in unexpected runtime exceptions.None.
avoid_dynamic_typev0.4.0Forbids to use a dynamic keyword.dynamic is allowed inside Map<> for json serialization.
avoid_late_keywordv0.1.0Forbids late keyword as it may result in unexpected runtime exceptions.late is allowed only with instant initializer.
avoid_redundant_asyncv0.3.0Finds redundant async functions, method and keywords.Overridden methods and getters.
avoid_widget_functionv0.4.0Forbids 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_orderv0.5.0Forces developers to put super.dispose() calls in the end of method. Only for StatefulWidget.None.
prefer_returning_conditionv0.5.0Finds if-else statements with 'return' of boolean literal in both 'then' and 'else' statements. Proposes to return condition instead.None.
strict_double_literalv0.6.0Forces developers to remove redundant zeros from double literals.None.
use_const_borderv0.2.0Forces 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_radiusv0.2.0Forces 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_viewv0.3.0Forces developers to use ListView instead of SingleChildScrollView with nested ColumnNone.