Complete AI TrainingYourJobSkills for your job

Skills / super-code

dart

Language-specific super-code guidelines for dart.

Dart: Idiomatic Efficiency Reference

When to Use

  • Use this skill when the task matches this description: Language-specific super-code guidelines for dart.

Table of Contents

  1. [Null Safety](#nulls)
  2. [Collections & Iteration](#collections)
  3. [Classes & Records](#classes)
  4. [Async/Await & Streams](#async)
  5. [Error Handling](#errors)
  6. [Flutter-Specific Patterns](#flutter)
  7. [Anti-patterns specific to Dart](#antipatterns)

1. Null Safety {#nulls}

// ❌ Manual null check
String display;
if (user.name != null) {
  display = user.name!;
} else {
  display = 'Unknown';
}

// ✅
final display = user.name ?? 'Unknown';
// ❌ Nested null checks
if (user != null && user.address != null && user.address!.city != null) {
  print(user.address!.city!);
}

// ✅
final city = user?.address?.city;
if (city != null) print(city);
// ❌ Late field when nullable is correct
late String name; // crashes if accessed before assignment

// ✅ — use late only when you guarantee initialization before access
String? name; // honestly nullable
// late is fine for: late final _controller = TextEditingController();
// ❌ Bang operator (!) everywhere
final name = user.name!;
final city = user.address!.city!;

// ✅ — promote through null checks
final name = user.name;
if (name == null) return;
// name is now non-null (promoted)

2. Col

Subscribers only

The full skill, its 1 bundled files and every download is included with every paid Complete AI plan.

Details

Sourcecommunity
License
Risk labelsafe ("critical" means the skill may run commands or touch files — read before use)
FilesSKILL.md
Added2026-06-16

Related skills

bash

Language-specific super-code guidelines for bash.

c

Language-specific super-code guidelines for c.

cpp

Language-specific super-code guidelines for cpp.

csharp

Language-specific super-code guidelines for csharp.

elixir

Language-specific super-code guidelines for elixir.

go

Language-specific super-code guidelines for go.