Usually no — if those files are inside the same Dart package, prefer relative imports instead of `package:myapp/...` imports. Example: ```dart import '../models/user.dart'; import 'formatters.dart'; ``` Prefer that over: ```dart import 'package:myapp/models/user.dart'; import 'package:myapp/utils/formatters.dart'; ``` Why: - relative imports make it obvious the dependency is local to the same package - they avoid mixing external-style and internal-style imports - they match the style rule: do...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill dart-best-practices --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Dart Best Practices?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-dart-best-practices-26bac5ab)More formats (shields.io, HTML) on the badges page.
Usually no — if those files are inside the same Dart package, prefer relative imports instead of `package:myapp/...` imports.
Example:
```dart
import '../models/user.dart';
import 'formatters.dart';
```
Prefer that over:
```dart
import 'package:myapp/models/user.dart';
import 'package:myapp/utils/formatters.dart';
```
Why:
- relative imports make it obvious the dependency is local to the same package
- they avoid mixing external-style and internal-style imports
- they match the style rule: do not use package imports within the same package
Use `package:` imports for code coming from other packages, including public dependencies:
```dart
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
```
A good rule of thumb:
- same package, nearby source file: use relative import
- different package: use `package:` import
Also keep imports organized and clean:
- remove unused imports
- avoid duplicate paths to the same library
- keep local relative imports separate from external package imports if your formatter/lints expect grouping
So if your file currently uses `package:myapp/...` everywhere for internal files, I would treat that as a style issue and convert those intra-package imports to relative ones.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!