Skip to content
Back to skills

Dart Best Practices

ASecurity

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...

  • 584 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmentgo

Security analysis

A100/100

Pro scans all 12 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill dart-best-practices --agent claude-code

Installs 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 with every re-scan.

Security grade badge for Dart Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-dart-best-practices-26bac5ab/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-dart-best-practices-26bac5ab)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
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.md1.8 KB
  • eval-1.with-skill.md1.8 KB
  • eval-2.baseline.md1.3 KB
  • eval-2.with-skill.md1.7 KB
  • eval-3.baseline.md1.4 KB
  • eval-3.with-skill.md1.2 KB
  • trigger-1.md165 B
  • trigger-2.md159 B
  • trigger-3.md150 B
  • trigger-4.md143 B
  • trigger-5.md158 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.