hoangnguyen0403/dart-language
Dart 3.x language feature standards: null safety, records, sealed classes, switch pattern matching, extensions, and async/await. Use when using !, ?., ??, late, sealed classes, record types, switch expressions, or async patterns — and before introducing any new Dart 3.x construct to confirm the modern idiomatic approach.
npx skills add https://github.com/HoangNguyen0403/agent-skills-standard --skill dart-language
!. Use ?., ??, or short-circuiting. Use late only if necessary.final for all variables. Use @freezed for data classes.switch (value) with patterns and destructuring.(String, int)) for multiple values; use named fields when meaning matters. Destructure at call sites: final (error, data) = fetchUser();.sealed class for exhaustive state handling in domain logic.extension to add utility methods to third-party types._ for unused variables in declarations and patterns.list.forEach(print)) over anonymous lambdas (e.g., list.forEach((e) => print(e))).async/await over raw Future.then. Use unawaited for fire-and-forget logic if necessary._ prefix for library-private members. Prefer final properties.collection-if, collection-for, and spread operators .....firstOrNull, .lastOrNull, or .elementAtOrNull(i).Object or generics instead of dynamic.typedef for complex IDs or callbacks.! unless you can prove value non-null via if or assert.var for class members; use final or explicit types.int get invoiceType => not int toInvoiceType().get apiFilterType not get invoiceType.// Sealed class and Switch expression
sealed class Result {}
class Success extends Result { final String data; Success(this.data); }
class Failure extends Result {}
String message(Result r) => switch (r) {
Success(data: var d) => "Got $d",
Failure() => "Error",
};
! with ?-aware access, explicit narrowing, or a guard clause; do not silence nullability with a force unwrap.When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
Take hoangnguyen0403/dart-language from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.