Skip to content
pubscout

import_lint

2.0.0, released 7 months ago by kawa.dev

Defines rules to restrict imports and perform static analysis in Dart code.

$ flutter pub add import_lint
Source repository

What it does

The import_lint package enforces custom import restrictions and rules via static analysis and a CLI tool. It integrates with the Dart analysis server to report unauthorized imports directly in your IDE.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to enforce architectural boundaries and restrict specific imports between layers or packages.
  • You need CLI or IDE warnings for prohibited import paths.

Skip it when

  • Your project uses a Dart SDK older than 3.10.0.
  • You do not need strict architectural layering rules for imports.

Strengths

  • Integrates directly into the IDE via analysis server plugins.
  • Provides both CLI support and IDE lint warnings.
  • Customizable glob patterns for targets, sources, and exceptions.

Weaknesses

  • Requires manual restart of the Dart Analysis Server after updating configuration plugins.
  • Strict Dart SDK version requirement (>=3.10.0 <4.0.0).

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
8

Add import_lint as a dev_dependency, configure rules in analysis_options.yaml, and restart the Dart Analysis Server.

plugins:
  import_lint: <version number>

import_lint:
  rules:
    example_rule:
      target: "package:example/target/*.dart"
      from: "package:example/from/*.dart"
      except: ["package:example/from/except.dart"]

Alternatives

Packages that do the same job and could replace import_lint.

  • lints

    Official recommended lints from the Dart team for standard stylistic and correctness rules.

  • flutter_lints

    Official recommended lints specifically tailored for Flutter applications.

Works with

Packages commonly used together with import_lint: ones it builds on, ones built on it, and its own family.