Documentation
README
Dart 3 Updates Skill
Apply Dart 3 language features โ branches, patterns, pattern types, and records โ correctly and idiomatically.
When to Use
Use this skill when:
- Writing or refactoring
switchstatements orif-elsechains. - Creating new data-holding classes and deciding between sealed classes, records, or plain classes.
- Destructuring values from maps, lists, records, or objects.
- Modernizing pre-Dart-3 code to use patterns, exhaustiveness checks, or switch expressions.
1. Branches
if / if-case
// Standard if
if (score >= 90) {
grade = 'A';
} else if (score >= 80) {
grade = 'B';
} else {
grade = 'C';
}
// if-case: match and destructure against a single pattern
if (pair case [int x, int y]) {
print('$x, $y');
}
This is the opening of the README. Read the full README on GitHub.