back
loading skill details...
Help users write syntactically and semantically correct primary constructors in Dart, and migrate/use the new constructor syntax, empty-body semicolon syntax,…
Dart Primary Constructors & New Constructor Syntax Skill
Use this skill when helping users write, refactor, or debug code using Dart's Primary Constructors feature.
Dart Version Requirements
Dart 3.13 and above: Primary constructors are enabled by default.
Dart 3.12: The feature is available but experimental. Users must explicitly enable the experiment flag primary-constructors via --enable-experiment=primary-constructors or in analysis_options.yaml:
analyzer:
enable-experiment:
- primary-constructors
Dart 3.11 and earlier: Primary constructors are not supported.
1. Overview
Primary Constructors allow developers to declare a non-redirecting generative constructor as well as a set of instance variables directly in the class header. This significantly reduces boilerplate and improves code readability.don't have the plugin yet? install it then click "run inline in claude" again.