Dart Analyze logoDart Analyze/
DRT-W1026

Prefer relative imports for files in `lib/`DRT-W1026

Major severityMajor
Bug Risk categoryBug Risk

PREFER relative imports for files in lib/.

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 relative imports for files within the lib/ directory.

BAD:

import 'package:my_package/bar.dart';

GOOD:

import 'bar.dart';