Lightlines
By dart-lang

dart-use-pattern-matching

dart-lang13.9k installs

Refactor Dart with patterns that fit the data.

What it does

Guides Dart refactoring with pattern matching to validate structured data, unpack values, and handle sealed types exhaustively.

When to use it

Use when refactoring complex if-else chains, parsing polymorphic data, destructuring collections or records, or enforcing sealed-class exhaustiveness; avoid simple conditions, single-variable type promotion, and basic collection filtering.

How to use it

It changes how the agent writes and refactors Dart code, favoring pattern matching where it simplifies the code and ordinary conditionals where it does not.

What you provide

  • An existing project

Latest review

What you need · 1

Uses Dart 3 pattern-matching features.


Access · 0

No additional actions listed.