
Dart Modern Features
- 302 installs
- 139 repo stars
- Updated July 11, 2026
- kevmoo/dash_skills
dart-modern-features is an agent skill that guides Dart 3.0 through 3.10 language features—including records, pattern matching, switch expressions, extension types, and class modifiers—for developers writing or refactori
About
dart-modern-features is an agent skill from kevmoo/dash_skills that documents modern Dart idioms for code targeting Dart 3.0 and later. Covered features include records and pattern matching for multi-value returns and deep extraction; switch expressions; extension types; class modifiers such as sealed and final; wildcards; null-aware collection elements; and dot shorthands introduced through Dart 3.10. Developers reach for dart-modern-features when writing new Dart code, reviewing Flutter widgets, or refactoring legacy Dart to safer exhaustive checks and concise syntax. The skill fits agent sessions where agents must choose derived data structures and pattern guards over verbose imperative null checks. Use it whenever Dart 3 migration, idiomatic refactors, or exhaustive switch logic appear in Flutter app or server-side Dart service work.
- Records and pattern matching
- Null-safety idioms
- Extension methods usage
- Async and stream best practices
- Dart 3 language features
Dart Modern Features by the numbers
- 302 all-time installs (skills.sh)
- +10 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #373 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/kevmoo/dash_skills --skill dart-modern-featuresAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 302 |
|---|---|
| repo stars | ★ 139 |
| Last updated | July 11, 2026 |
| Repository | kevmoo/dash_skills ↗ |
How do you use Dart 3 pattern matching idioms?
Apply modern Dart language features and idioms when building Flutter apps or server-side Dart code in Claude-assisted sessions.
Who is it for?
Flutter and server-side Dart developers targeting Dart 3.0+ who want agents to apply records, patterns, and class modifiers during writes and refactors.
Skip if: Pre-Dart-3 codebases that cannot upgrade language constraints, or teams writing only JavaScript or Kotlin with no Dart source.
When should I use this skill?
The developer writes or reviews Dart 3 code, refactors legacy Dart, or asks about records, pattern matching, switch expressions, or extension types.
What you get
Dart 3.0+ code using records, exhaustive patterns, switch expressions, extension types, sealed modifiers, and null-aware collection elements.
- Idiomatic Dart 3 code
- Refactored pattern-matching logic
By the numbers
- Covers Dart 3.0 through 3.10 language features
- Documents 8 feature areas: records, patterns, switch expressions, extension types, class modifiers, wildcards, null-awar
Files
Dart Modern Features
1. When to use this skill
Use this skill when:
- Writing or reviewing Dart code targeting Dart 3.0 or later.
- Refactoring legacy Dart code to use modern, concise, and safe features.
- Looking for idiomatic ways to handle multiple return values, deep data
extraction, or exhaustive checking.
Discovery
To find candidates for modernization:
Switch Expressions
Search for switch statements where every case assigns to the same variable or returns:
- Regex:
switch\s*\([^)]+\)\s*\{\s*case
Pattern Matching Candidates
Search for manual map or JSON property extraction and type checking:
- Regex:
containsKey\(['"][^'"]+['"]\) - Regex:
json\[['"][^'"]+['"]\]\s+is\s+
Null-Aware Elements
Search for collection if statements checking for null:
- Regex:
if\s*\(\w+\s*!=\s*null\)\s*\w+
Digit Separators
Search for long numbers without separators:
- Regex:
\b\d{6,}\b(Matches numbers with 6 or more digits).
2. Features
Records
Use records as anonymous, immutable, aggregate structures to bundle multiple objects without defining a custom class. Prefer them for returning multiple values from a function or grouping related data temporarily.
Avoid: Creating a dedicated class for simple multiple-value returns.
class UserResult {
final String name;
final int age;
UserResult(this.name, this.age);
}
UserResult fetchUser() {
return UserResult('Alice', 42);
}Prefer: Using records to bundle types seamlessly on the fly.
(String, int) fetchUser() {
return ('Alice', 42);
}
void main() {
var user = fetchUser();
print(user.$1); // Alice
}Patterns and Pattern Matching
Use patterns to destructure complex data into local variables and match against specific shapes or values. Use them in switch, if-case, or variable declarations to unpack data directly.
Avoid: Manually checking types, nulls, and keys for data extraction.
void processJson(Map<String, dynamic> json) {
if (json.containsKey('name') && json['name'] is String &&
json.containsKey('age') && json['age'] is int) {
String name = json['name'];
int age = json['age'];
print('$name is $age years old.');
}
}Prefer: Combining type-checking, validation, and assignment into a single statement.
void processJson(Map<String, dynamic> json) {
if (json case {'name': String name, 'age': int age}) {
print('$name is $age years old.');
}
}Switch Expressions
Use switch expressions to return a value directly, eliminating bulky case and break statements.
Avoid: Using switch statements where every branch simply returns or assigns a value.
String describeStatus(int code) {
switch (code) {
case 200:
return 'Success';
case 404:
return 'Not Found';
default:
return 'Unknown';
}
}Prefer: Returning the evaluated expression directly using the => syntax.
String describeStatus(int code) => switch (code) {
200 => 'Success',
404 => 'Not Found',
_ => 'Unknown',
};Class Modifiers
Use class modifiers (sealed, final, base, interface) to restrict how classes can be used outside their defines library. Prefer sealed for defining closed families of subtypes to enable exhaustive checking.
Avoid: Using open abstract classes when the set of subclasses is known and fixed.
abstract class Result {}
class Success extends Result {}
class Failure extends Result {}
String handle(Result r) {
if (r is Success) return 'OK';
if (r is Failure) return 'Error';
return 'Unknown';
}Prefer: Using sealed to guarantee to the compiler that all cases are covered.
sealed class Result {}
class Success extends Result {}
class Failure extends Result {}
String handle(Result r) => switch(r) {
Success() => 'OK',
Failure() => 'Error',
};Extension Types
Use extension types for a zero-cost wrapper around an existing type. Use them to restrict operations or add custom behavior without runtime overhead.
Avoid: Allocating new wrapper objects just for domain-specific logic or type safety.
class Id {
final int value;
Id(this.value);
bool get isValid => value > 0;
}Prefer: Using extension types which compile down to the underlying type at runtime.
extension type Id(int value) {
bool get isValid => value > 0;
}Digit Separators
Use underscores (_) in number literals strictly to improve visual readability of large numeric values.
Avoid: Long number literals that are difficult to read at a glance.
const int oneMillion = 1000000;Prefer: Using underscores to separate thousands or other groupings.
const int oneMillion = 1_000_000;Wildcard Variables
Use wildcards (_) as non-binding variables or parameters to explicitly signal that a value is intentionally unused.
Avoid: Inventing clunky, distinct variable names to avoid "unused variable" warnings.
void handleEvent(String ignoredName, int status) {
print('Status: $status');
}Prefer: Explicitly dropping the binding with an underscore.
void handleEvent(String _, int status) {
print('Status: $status');
}Null-Aware Elements
Use null-aware elements (?) inside collection literals to conditionally include items only if they evaluate to a non-null value.
Avoid: Using collection if statements for simple null checks.
var names = [
'Alice',
if (optionalName != null) optionalName,
'Charlie'
];Prefer: Using the ? prefix inline.
var names = ['Alice', ?optionalName, 'Charlie'];Dot Shorthands
Use dot shorthands to omit the explicit type name when it can be confidently inferred from context, such as with enums or static fields.
Avoid: Fully qualifying type names when the type is obvious from the context.
LogLevel currentLevel = LogLevel.info;Prefer: Reducing visual noise with inferred shorthand.
LogLevel currentLevel = .info;Related Skills
- [dart-best-practices]: General code
style and foundational Dart idioms that predate or complement the modern syntax features.
[dart-best-practices]: https://github.com/kevmoo/dash_skills/blob/main/skills/dart-best-practices/SKILL.md
Related skills
How it compares
Pick dart-modern-features over generic Flutter skills when agents need Dart 3 syntax guidance for records, patterns, and sealed classes—not widget layout alone.
FAQ
Which Dart versions does dart-modern-features cover?
dart-modern-features covers Dart 3.0 through 3.10 language features including records, pattern matching, switch expressions, extension types, class modifiers, wildcards, null-aware elements, and dot shorthands.
When should developers invoke dart-modern-features?
dart-modern-features applies when writing or reviewing Dart 3 code, refactoring legacy Dart, or handling multi-return records, deep extraction, and exhaustive switch logic in Flutter or server-side Dart projects.