use_ package_ imports
Avoid relative imports for files in
This rule is available as of Dart 2.10.0.
This rule has a quick fix available.
Incompatible rules: prefer_relative_imports
DO avoid relative imports for files in
When mixing relative and absolute imports it’s possible to create confusion
where the same member gets imported in two different ways. One way to avoid
that is to ensure you consistently use absolute imports for files within the
This is the opposite of ‘prefer_relative_imports’.
You can also use ‘avoid_relative_lib_imports’ to disallow relative imports of
lib/ directory outside of it (for example
import 'baz.dart'; import 'src/bag.dart' import '../lib/baz.dart'; ...
import 'package:foo/bar.dart'; import 'package:foo/baz.dart'; import 'package:foo/src/baz.dart'; ...
To enable the
always_use_package_imports under linter > rules in your
linter: rules: - always_use_package_imports