dart-use-pattern-matching

dart use pattern matching

dart-lang 411 ↓ 10k BSD-3-Clause updated 28d ago
Claude Code
View source ↗

What it does

  • Pattern Selection Strategy
  • Switch Statements vs. Expressions
  • Core Pattern Implementations
  • If validating and extracting from deserialized data (e.g., JSON): Use Map and List patterns to simultaneously check structure and destructure key-value pairs.
  • If handling multiple return values: Use Record patterns to destructure fields directly into local variables.
  • If executing type-specific behavior (Algebraic Data Types): Use Object patterns combined with sealed classes to ensure exhaustiveness.
  • If matching numeric ranges or conditions: Use Relational (>=, <=) and Logical-and (&&) patterns.

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

dart use pattern matching

Source

Repository: https://github.com/dart-lang/skills

dart-use-pattern-matching FAQ

What does the dart-use-pattern-matching skill do?

Use switch expressions and pattern matching where appropriate Pattern Selection Strategy Switch Statements vs. Expressions

How do I install dart-use-pattern-matching?

Run: npx -y skills add https://github.com/dart-lang/skills --skill dart-use-pattern-matching --agent claude-code — the source lives at github.com/dart-lang/skills.

Maintain dart-use-pattern-matching?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

dart-use-pattern-matching on getagentictools
[![dart-use-pattern-matching on getagentictools](https://getagentictools.com/badge/skills/dart-lang-skills-dart-use-pattern-matching.svg)](https://getagentictools.com/skills/dart-lang-skills-dart-use-pattern-matching?ref=badge)
npx agentictools info skills/dart-lang-skills-dart-use-pattern-matching

The second line is the CLI lookup for this page — handy in READMEs and docs.