dart-language-syntax

Installation
SKILL.md

Writing Idiomatic Dart

Contents

Variables and State Management

Manage state and variable declarations using strict mutability and type inference rules.

  • Prefer var: Use var for local variables when the assigned type is obvious (e.g., var name = 'Bob';). Use explicit types when the type is not immediately clear from the initializer.
  • Enforce Immutability: Use final for variables that should not be reassigned after initialization. Use const for compile-time constants and to create canonicalized, immutable object instances.
  • Leverage late: Use the late modifier to defer initialization of non-nullable variables until their first use, especially for expensive computations or when initialization requires access to this.
  • Implement Wildcards: Use the wildcard variable _ (requires Dart 3.7+) to discard unused values in local declarations, closures, or pattern matching without triggering unused variable warnings.

Functions and Closures

Structure functions for maximum composability and minimal boilerplate.

Related skills
Installs
73
GitHub Stars
221
First Seen
Mar 17, 2026