
Description
dart-use-primary-constructors is an agent skill that helps an AI assistant write, refactor and debug code that uses Dart's primary constructors. A primary constructor lets you declare a non-redirecting generative constructor and the instance variables directly in the class header, which removes much of the boilerplate in a class and improves readability. The skill also covers the newer constructor syntax and the empty-body semicolon syntax. It sets out which Dart versions support the feature: in Dart 3.13 and later primary constructors are on by default, in Dart 3.12 the feature is experimental and must be enabled with the primary-constructors experiment flag on the command line or in analysis_options.yaml, and Dart 3.11 and earlier do not support it. Using the skill, the assistant can check a project's Dart version before writing code that depends on the feature.…
Highlights
- Primary constructors in Dart
- Newer constructor and semicolon syntax
- Checks the Dart version first
- Experiment flag guidance for Dart 3.12
- Install with npx skills add
Ratings & Reviews
No ratings yet
Be the first to rate dart-use-primary-constructors.
People also visit
dart-use-primary-constructors FAQ
What does this skill help with?
Writing, refactoring and debugging Dart code that uses primary constructors and the newer constructor syntax.
Which Dart version do I need?
Dart 3.13 and later enable primary constructors by default. Dart 3.12 needs the primary-constructors experiment flag, and 3.11 and earlier do not support it.
How do I enable it on Dart 3.12?
Pass --enable-experiment=primary-constructors, or add it under the analyzer enable-experiment setting in analysis_options.yaml.
How do I install it?
Run npx skills add https://github.com/flutter/agent-plugins --skill dart-use-primary-constructors.
What are the best dart-use-primary-constructors alternatives?
Popular alternatives to dart-use-primary-constructors include dart-use-pattern-matching, dart and developing-genkit-dart. See all dart-use-primary-constructors alternatives











