dart-use-pattern-matching
Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types, and decompose control flow. Use when refactoring complex if-else chains, parsing polymorphic JSON or API responses, destructuring Lists, URI/path segments, String.split() tokens, Records, or Maps, or enforcing exhaustiveness on sealed classes. Don't use for simple boolean conditions, single-variable type promotion (use is), or basic collection filtering.
Pinned to revision 4e8964e24a5a, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/dart-use-pattern-matching/SKILL.md
- skills/dart-use-pattern-matching/LICENSE
- skills/dart-use-pattern-matching/examples/json_patterns.dart
Every link opens the file at its source, pinned to the revision this page describes.