dart-use-primary-constructors
Write Dart Primary Constructors Correctly
Primary constructor migrations can introduce syntax, scope, and initialization errors. This skill provides version-aware guidance, refactoring steps, diagnostics, and focused examples for Dart.
Установить с помощью моего Агента
Скопируйте этот запрос в своего Агента. Он содержит каноническую страницу Skill и манифест.
Review the Skillstore skill "dart-use-primary-constructors" from https://skillstore.io/skills/dart-lang-dart-use-primary-constructors.md and its manifest at https://skillstore.io/api/skills/dart-lang-dart-use-primary-constructors/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Ваш Агент по-прежнему должен показать план и запросить все подтверждения, требуемые политикой безопасности.
Ресурсы для AI-агентов
Используйте эти ссылки, когда AI-агенту, crawler или script нужен чистый контекст вместо полной страницы.
Протестировать
Использование «dart-use-primary-constructors». Explain whether primary constructors are available in Dart 3.12.
Ожидаемый результат:
Dart 3.12 treats primary constructors as experimental. Enable the primary-constructors experiment in analyzer configuration or with the compiler flag.
Использование «dart-use-primary-constructors». Migrate a user model with final name and age fields.
Ожидаемый результат:
Move both final fields into the class header as declaring parameters. Remove the duplicate field declarations and constructor, then use a semicolon body.
Использование «dart-use-primary-constructors». Explain why a late field cannot use a primary constructor parameter.
Ожидаемый результат:
Primary initializer scope excludes late field initializers because they may run after construction. Store the value in a non-late field first.
Аудит безопасности
БезопасноAll 62 static findings are false positives caused by Markdown backticks, fenced Dart examples, or ordinary documentation text. The skill contains no executable scripts, shell interpolation, system reconnaissance, prompt injection, or other malicious intent.
Факторы риска
⚙️ Внешние команды (50)
Поделиться и цитировать этот отчет
Делитесь версионным отчетом об оценке, нейтральным значком, встраиваемой карточкой и цитатами. Skillstore публикует доказательства, не решая, безопасен ли этот Skill.
Копировать ссылку на отчёт
https://skillstore.io/skills/dart-lang-dart-use-primary-constructors/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportЗначок Markdown
[](https://skillstore.io/skills/dart-lang-dart-use-primary-constructors?utm_source=security_passport_badge)Значок HTML
<a href="https://skillstore.io/skills/dart-lang-dart-use-primary-constructors?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/dart-lang-dart-use-primary-constructors/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Встраиваемая карточка
<iframe src="https://skillstore.io/embed/skills/dart-lang-dart-use-primary-constructors.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Академические ссылки (APA · BibTeX · CFF)
Цитата APA
dart-lang. (2026). dart-use-primary-constructors security audit report (audit version 1) [Author version unspecified]. Skillstore. https://skillstore.io/skills/dart-lang-dart-use-primary-constructors/audits/1Цитата BibTeX
@techreport{dart-lang-dart-lang-dart-use-primary-constructors-2026,
author = {dart-lang},
title = {dart-use-primary-constructors security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/dart-lang-dart-use-primary-constructors/audits/1},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "dart-use-primary-constructors security audit report (audit version 1)"
version: "unspecified"
type: report
authors:
- name: "dart-lang"
date-released: "2026-08-22"
url: "https://skillstore.io/skills/dart-lang-dart-use-primary-constructors/audits/1"
identifiers:
- type: other
value: "skillstore:dart-lang-dart-use-primary-constructors:audit:1"
description: "Skillstore immutable audit report identifier"
Сравнить варианты
2 устанавливаемых вариантовНавык каждого автора остаётся отдельным устанавливаемым вариантом. Рекомендуемый вариант ранжируется по данным Skillstore.
Почему этот вариант первый
flutter-dart-use-primary-constructors
2026-09-09
dart-lang-dart-use-primary-constructors
2026-09-09
Оценка Skillstore
Почему такая оценка Достоверность доказательств: СреднийЧто вы можете построить
Learn Primary Constructor Syntax
Understand parameter types, semicolon bodies, initializer scope, and version requirements through focused explanations.
Migrate Existing Models
Convert verbose data classes while preserving fields, assertions, calculations, and redirecting constructors.
Review Constructor Refactors
Identify scope violations, duplicate initialization, late-field errors, and invalid generative constructors before integration.
Попробуйте эти промпты
Explain Dart primary constructors for a beginner, including supported versions and the three parameter types.
Convert this Dart class to a primary constructor and explain each change: [class source].
Review this primary constructor, identify compile-time errors, and propose a corrected version: [class source].
Design a migration for these related Dart classes while preserving inheritance, redirects, assertions, public APIs, and SDK compatibility: [sources].
Лучшие практики
- Confirm the project Dart version before suggesting primary constructor syntax.
- Preserve assertions, initialization order, redirects, and public behavior during migration.
- Run the Dart analyzer and relevant tests after applying a generated refactor.
Избегать
- Do not use primary constructor parameters inside late field initializers.
- Do not initialize the same field in both its declaration and initializer list.
- Do not add a nonredirecting generative constructor beside a primary constructor.