Dart 3 Modernization Guide
A skill for writing idiomatic Dart 3 pattern matching, records and sealed classes, and for migrating pre-Dart-3 code.
Dev & CodingIntermediate★ 631⑂ 64AI score 8/10Last updated: Aug 31, 2026
What it does
- Writes correct Dart 3
switchstatements/expressions,if-casebranches andwhenguard clauses. - Explains destructuring of lists, maps, records and objects via patterns.
- Provides a full reference table of pattern types (logical or/and, relational, cast, null-check, rest elements, and more).
- Gives decision criteria for choosing records versus data classes.
- Modernizes legacy code with a 4-step workflow: if-else → switch expressions, abstract → sealed classes, wrapper classes → records, then verify with
dart analyze.
Who it's for
- Flutter/Dart developers upgrading a codebase to modern syntax.
- Anyone converting state or Result/Success/Failure hierarchies into sealed classes for exhaustive switches.
- Maintainers cleaning up long if-else chains or old
break-heavy switches.
Examples
- "Turn this status if-else chain into a switch expression" → exhaustive enum-based switch expression.
- "Safely validate this API JSON response" → suggests map/list patterns like
if (data case {'user': [String name, int age]}). - "My function returns two values — do I need a class?" → applies the record-vs-class criteria and returns
(String name, int age)with destructuring.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/evanca/flutter-ai-rules/HEAD/skills/dart-3-updates/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/dart-3-updates folder from the GitHub repo evanca/flutter-ai-rules into my ~/.claude/skills/dart-3-updates/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/evanca/flutter-ai-rules.git /tmp/flutter-ai-rules && mkdir -p ~/.claude/skills && cp -r /tmp/flutter-ai-rules/skills/dart-3-updates ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Clone the repository:
git clone https://github.com/evanca/flutter-ai-rules.git - Create the skills directory if needed:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r flutter-ai-rules/skills/dart-3-updates ~/.claude/skills/ - Restart Claude Code, then ask something like "refactor this switch to Dart 3 style" and the skill activates automatically.
- Confirm your
pubspec.yamlSDK constraint is>=3.0.0; otherwise the pattern syntax will not compile.
View source on GitHub ↗License: MIT