Dart Best Practices
ASecurityUsually 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...
- 584 stars
- 0 votes
- 0 copies
- 1 view
- Added September 5, 2026
Security analysis
100/100Pro scans all 12 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill dart-best-practices --agent claude-codeAre you the author of Dart Best Practices?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-dart-best-practices-26bac5ab)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.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
- trigger-5.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.