Best use case
dart is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Dart programming for Flutter mobile and web development. Use for .dart files.
Teams using dart should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/dart/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How dart Compares
| Feature / Agent | dart | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Dart programming for Flutter mobile and web development. Use for .dart files.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Dart
Modern Dart development with null safety, pattern matching, and Flutter integration.
## When to Use
- Working with `.dart` files
- Building Flutter mobile/web/desktop apps
- Server-side Dart development
- Creating packages for pub.dev
## Quick Start
```dart
class User {
final String id;
final String name;
final String email;
const User({required this.id, required this.name, required this.email});
factory User.fromJson(Map<String, dynamic> json) => User(
id: json['id'] as String,
name: json['name'] as String,
email: json['email'] as String,
);
}
```
## Core Concepts
### Null Safety
```dart
// Non-nullable by default
String name = 'John';
// Nullable with ?
String? maybeNull;
// Late initialization
late final String lazyInit;
// Null-aware operators
String greeting = person?.name ?? 'Guest';
person?.address?.city;
```
### Records & Pattern Matching (Dart 3)
```dart
// Records
(String, int) getPerson() => ('John', 25);
// Destructuring
final (name, age) = getPerson();
// Switch expressions with patterns
String describe(Object obj) => switch (obj) {
int i when i < 0 => 'negative',
int i => 'positive: $i',
String s => 'string: $s',
_ => 'unknown',
};
// Sealed classes
sealed class Result<T> {}
class Success<T> extends Result<T> { final T value; Success(this.value); }
class Failure<T> extends Result<T> { final String error; Failure(this.error); }
```
## Common Patterns
### Async/Await
```dart
Future<User> fetchUser(String id) async {
final response = await http.get(Uri.parse('$baseUrl/users/$id'));
if (response.statusCode != 200) {
throw Exception('Failed to load user');
}
return User.fromJson(jsonDecode(response.body));
}
// Parallel execution
Future<void> loadData() async {
final results = await Future.wait([
fetchUser('1'),
fetchOrders('1'),
]);
}
// Streams
Stream<int> countStream(int max) async* {
for (int i = 0; i < max; i++) {
await Future.delayed(Duration(seconds: 1));
yield i;
}
}
```
### Extensions
```dart
extension StringExtension on String {
String capitalize() =>
isEmpty ? this : '${this[0].toUpperCase()}${substring(1)}';
bool get isValidEmail =>
RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(this);
}
```
## Best Practices
**Do**:
- Use `const` constructors when possible
- Prefer `final` for immutable variables
- Use named parameters with `required`
- Follow effective_dart lints
**Don't**:
- Use `dynamic` when type is known
- Force unwrap with `!` unnecessarily
- Create God classes (keep small)
- Ignore `late` initialization errors
## Troubleshooting
| Error | Cause | Solution |
| ---------------------------------- | ------------------------------ | ------------------------ |
| `Null check operator used on null` | Using `!` on null value | Add null check first |
| `LateInitializationError` | Accessing late var before init | Initialize before access |
| `type 'Null' is not a subtype` | Type mismatch with null | Check nullable types |
## References
- [Dart Official Docs](https://dart.dev/guides)
- [Effective Dart](https://dart.dev/effective-dart)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.