Dart Use Pattern Matching

dart-lang/skills/skills/dart-use-pattern-matching

by dart-lang0d9f1c4a0ae29d6f5180bf6143d7997ec3bacf49No license515 starsListed Oct 9, 2026Updated Oct 9, 2026Repository updated 10 days ago

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.

Only the file list is public. File contents are available once the skill is installed in a workspace.

PathSizeType
examples/json_patterns.dart2.6 KBtext/plain
SKILL.md11.7 KBtext/markdown

Source and attribution

Source:dart-lang/skillsinskills/dart-use-pattern-matchingat commit0d9f1c4

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal