Dart Use Primary Constructors
Concise Dart primary constructor reference covering declaring, initializing, and concise constructor syntax with scoping rules.
- CCM score
- 64 of 100
- skills.sh installs
- 17.8K
- GitHub stars
- 3.2K
- last updated
- Nov 28, 2026
Own this skill? Claim it
What it does
- Covers primary constructor syntax for classes, extension types, enums, and const variants across Dart 3.12 and 3.13
- Explains declaring, initializing, and plain parameters, plus the
this :in-body initializer list andthis {...}bodies - Documents Primary Initializer Scope, late field restrictions, parameter shadowing, and generative constructor redirection rules
- Includes an abbreviated
newandfactoryconstructor table and a diagnostics table for common errors and lints
Install
$ npx -y skills add flutter/agent-plugins --skill dart-use-primary-constructors -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
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-constructorsvia--enable-experiment=primary-constructorsor inanalysis_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.
Details
- Repository
- github.com/flutter/agent-plugins
- Category
- .NET & C#
- First seen
- Nov 28, 2026
Questions
What does the dart-use-primary-constructors skill do?
It helps the agent write, refactor and debug Dart code that uses primary constructors, including the empty-body semicolon syntax, in-body initializer lists and the abbreviated concise constructor syntax. It also covers the scoping rules and common compile errors for this syntax.
Which Dart version do I need to use primary constructors?
Primary constructors are enabled by default from Dart 3.13. On Dart 3.12 the feature is experimental and must be turned on with the primary-constructors experiment flag, while Dart 3.11 and earlier do not support them.
How do I install the dart-use-primary-constructors skill?
Run npx -y skills add flutter/agent-plugins --skill dart-use-primary-constructors -y in your project. The skill then lets the agent write Dart primary constructor declarations and migrate older constructor code to the new syntax.
Where does dart-use-primary-constructors rank in its category?
It sits in the .NET & C# category on Claude Marketplaces and ranks in the top 3 of that category page. Its listing is for Dart code, so it sits alongside .NET and C# skills such as dotnet-best-practices and nuget-manager rather than replacing them.
More from flutter/agent-plugins
All 13- Dart Use Ffigen17.6K
- Dart Setup Ffi Assets17.5K
- Flutter Apply Architecture Best Practices47.7K
- Flutter Build Responsive Layout47.4K
- Flutter Fix Layout Issues44.3K
- Flutter Add Widget Test43.4K
- Flutter Add Integration Test42.1K
- Flutter Setup Declarative Routing41.5K
- Flutter Implement Json Serialization41.4K
- Flutter Add Widget Preview40.5K
- Flutter Setup Localization40.4K
- Flutter Use Http Package39.6K
Similar to Dart Use Primary Constructors
More .NET & C#dotnet-best-practicesgithub/awesome-copilot16.4K installsEnsure .NET/C# code meets best practices for the solution/project.
nuget-managergithub/awesome-copilot14.7K installsManage NuGet packages in .NET projects/solutions. Use this skill when adding, removing, or updating NuGet package versions. It enforces using `dotnet` CLI for p
microsoft-code-referencegithub/awesome-copilot14.5K installsLook up Microsoft API references, find working code samples, and verify SDK code is correct. Use when working with Azure SDKs, .NET libraries, or Microsoft APIs
dotnet-upgradegithub/awesome-copilot11.8K installsReady-to-use prompts for comprehensive .NET framework upgrade analysis and execution
dotnet-design-pattern-reviewgithub/awesome-copilot11.8K installsReview the C#/.NET code for design pattern implementation and suggest improvements.
csharp-asyncgithub/awesome-copilot11.2K installsGet best practices for C# async programming