Best for
- Writing or refactoring switch statements or if-else chains.
- Creating new data-holding classes and deciding between sealed classes, records, or plain classes.
- Destructuring values from maps, lists, records, or objects.
evanca/flutter-ai-rules/skills/dart-3-updates/SKILL.md
Use when writing switch statements, refactoring if-else chains, creating data classes, choosing records vs classes, destructuring values, or modernizing pre-Dart-3 code.
Decision brief
Apply Dart 3 language features — branches, patterns, pattern types, and records — correctly and idiomatically.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/evanca/flutter-ai-rules --skill "skills/dart-3-updates"Inspect the Agent Skill "dart-3-updates" from https://github.com/evanca/flutter-ai-rules/blob/b294a77b68b5508f8d3151fb93d87ed9622d2ff1/skills/dart-3-updates/SKILL.md at commit b294a77b68b5508f8d3151fb93d87ed9622d2ff1. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
When modernizing pre-Dart-3 code, follow these steps:
Review the “Step 1 — Replace if-else chains with switch expressions” section in the pinned source before continuing.
Review the “Step 2 — Convert abstract class hierarchies to sealed classes” section in the pinned source before continuing.
Replace wrapper classes used solely for returning multiple values with records.
Run dart analyze to confirm exhaustiveness and type safety after each change.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 86/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 604 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Apply Dart 3 language features — branches, patterns, pattern types, and records — correctly and idiomatically.
Use this skill when:
switch statements or if-else chains.// 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');
}
if conditions must evaluate to a bool.if-case, variables declared in the pattern are scoped to the matching branch.else branch (if present).switch (command) {
case 'quit':
quit();
case 'start' || 'begin': // logical-or pattern
startGame();
default:
print('Unknown command');
}
case body executes and jumps to the end — break is not required.continue, throw, or return.default or _ to handle unmatched values.break to prevent fallthrough in an empty case.continue with a label for non-sequential fallthrough.case a || b) to share a body between cases.final color = switch (shape) {
Circle() => 'red',
Square() => 'blue',
_ => 'unknown',
};
case; use => for bodies; separate cases with commas._ (not default).switch statements and expressions at compile time.default/_, enums, or sealed types to satisfy exhaustiveness.sealed class Shape {}
class Circle extends Shape {}
class Square extends Shape {}
// Dart knows all subtypes — no default needed:
String describe(Shape s) => switch (s) {
Circle() => 'circle',
Square() => 'square',
};
switch (point) {
case (int x, int y) when x == y:
print('Diagonal: $x');
case (int x, int y):
print('$x, $y');
}
when condition after a pattern to further constrain matching.if-case, switch statements, and switch expressions.false, execution proceeds to the next case.Patterns represent the shape of a value for matching and destructuring.
// Variable declaration
var (a, [b, c]) = ('str', [1, 2]);
// Variable assignment (swap)
(b, a) = (a, b);
// for-in loop destructuring
for (final MapEntry(:key, :value) in map.entries) { ... }
// switch / if-case (see Branches section)
_ ignores parts of a matched value....) in list patterns ignore remaining elements.var Foo(:one, :two) = myFoo;
if (data case {'user': [String name, int age]}) {
print('$name, $age');
}
| Pattern | Syntax | Description |
|---|---|---|
| Logical-or | p1 || p2 | Matches if any branch matches. All branches must bind the same variables. |
| Logical-and | p1 && p2 | Matches if both match. Variable names must not overlap. |
| Relational | == c, < c, >= c | Compares value to a constant. Combine with && for ranges. |
| Cast | subpattern as Type | Asserts type, then matches inner pattern. Throws if type mismatch. |
| Null-check | subpattern? | Matches non-null; binds non-nullable type. |
| Null-assert | subpattern! | Matches non-null or throws. Use in declarations to eliminate nulls. |
| Constant | 42, 'str', const Foo() | Matches if value equals the constant. |
| Variable | var name, final Type name | Binds matched value to a new variable. Typed form only matches the declared type. |
| Wildcard | _, Type _ | Matches any value without binding. |
| Parenthesized | (subpattern) | Controls precedence. |
| List | [p1, p2] | Matches lists by position. Length must match unless a rest element is used. |
| Rest element | ..., ...rest | Matches arbitrary-length tails or collects remaining elements. |
| Map | {'key': subpattern} | Matches maps by key. Missing keys throw StateError. |
| Record | (p1, p2), (x: p1, y: p2) | Matches records by shape; field names can be omitted if inferred. |
| Object | ClassName(field: p) | Matches by type and destructures via getters. Extra fields ignored. |
// Create
var record = ('first', a: 2, b: true, 'last');
// Type annotation
({int a, bool b}) namedRecord;
// Access
print(record.$1); // positional: 'first'
print(record.a); // named: 2
$1, $2, .name); no setters.hashCode and == are automatically defined.(String name, int age) userInfo(Map<String, dynamic> json) {
return (json['name'] as String, json['age'] as int);
}
var (name, age) = userInfo(json);
// Named fields:
final (:name, :age) = userInfo(json);
Use a record when:
Use a class when:
copyWith.typedef for record types to improve readability and maintainability.When modernizing pre-Dart-3 code, follow these steps:
// Before (pre-Dart 3)
String label;
if (status == Status.loading) {
label = 'Loading...';
} else if (status == Status.success) {
label = 'Done';
} else {
label = 'Error';
}
// After (Dart 3)
final label = switch (status) {
Status.loading => 'Loading...',
Status.success => 'Done',
Status.error => 'Error',
};
// Before
abstract class Result {}
class Success extends Result { final String data; Success(this.data); }
class Failure extends Result { final String error; Failure(this.error); }
// After — enables exhaustive switch
sealed class Result {}
final class Success extends Result { const Success(this.data); final String data; }
final class Failure extends Result { const Failure(this.error); final String error; }
Replace wrapper classes used solely for returning multiple values with records.
Run dart analyze to confirm exhaustiveness and type safety after each change.
Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing
JasonColapietro/suede-creator-skills
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).