Problem:
Some files use relative imports (e.g. ../../shared/constants.dart) instead of package: imports. This can lead to:
- Confusing and brittle import paths
- Errors in deep test files or nested folders
- Inconsistent import style across the codebase
✅ Recommendation
Use package: imports consistently throughout the project:
// ✅ Preferred
import 'package:your_package_name/shared/constants.dart';
Instead of:
// ❌ Avoid
import '../../shared/constants.dart';
📐 Bonus
You can enforce this via analysis options:
linter:
rules:
always_use_package_imports: true
Impact:
- Improves readability and portability
- Avoids import breakage during refactors or test runs
- Promotes consistency in team workflows
Problem:
Some files use relative imports (e.g.
../../shared/constants.dart) instead ofpackage:imports. This can lead to:✅ Recommendation
Use
package:imports consistently throughout the project:Instead of:
📐 Bonus
You can enforce this via analysis options:
Impact: