Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rules Dart?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-dart)
---
name: rules-dart
description: "ANVIL coding rules for dart code (**/*.dart, **/*_test.dart, test/**/*.dart, integration_test/**/*.dart): Dart, Dart / Flutter Testing."
---
<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->
# ANVIL rules: dart
Follow these rules for dart code (**/*.dart, **/*_test.dart, test/**/*.dart, integration_test/**/*.dart).
## Dart
# Dart
- Sound null safety: avoid `!`; handle null explicitly.
- `const` constructors for widgets where possible; keep `build()` pure and cheap.
- Check `context.mounted` after `await` before using a `BuildContext`.
- Dispose controllers, streams and subscriptions.
## Dart / Flutter Testing
# Dart / Flutter Testing
- Group unit tests by component and use `testWidgets` with `tester.pumpAndSettle()` / bounded `pump(duration)` rather than real timers.
- Inject fake repositories, HTTP clients, and clocks cleanly instead of relying on network calls or platform plugins in unit tests.
- Find widgets via semantics (`find.bySemanticsLabel`), keys, or localized text safely rather than fragile tree depth assumptions.
- Dispose controllers and verify error, empty, loading, and success states in async notifiers/BLoCs.