[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-flutter-dart-use-primary-constructors":3,"mdc-7v904f-key":26,"related-org-flutter-dart-use-primary-constructors":2038,"related-repo-flutter-dart-use-primary-constructors":2176},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":16,"repoUrl":17,"updatedAt":18,"license":19,"forks":20,"topics":21,"repo":22,"sourceUrl":24,"mdContent":25},"dart-use-primary-constructors","implement Dart primary constructors","Help users write syntactically and semantically correct primary constructors in Dart, and migrate\u002Fuse the new constructor syntax, empty-body semicolon syntax, in-body initializer list syntax, and abbreviated concise constructor syntax.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"flutter","Flutter (Google)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fflutter.png",[12],{"name":13,"slug":14,"type":15},"Dart","dart","tag",2664,"https:\u002F\u002Fgithub.com\u002Fflutter\u002Fagent-plugins","2026-07-15T05:22:38.873578",null,155,[],{"repoUrl":17,"stars":16,"forks":20,"topics":23,"description":19},[],"https:\u002F\u002Fgithub.com\u002Fflutter\u002Fagent-plugins\u002Ftree\u002FHEAD\u002Fskills\u002Fdart-use-primary-constructors","---\nname: dart-use-primary-constructors\ndescription: >\n  Help users write syntactically and semantically correct primary constructors in Dart, and migrate\u002Fuse the new constructor syntax, empty-body semicolon syntax, in-body initializer list syntax, and abbreviated concise constructor syntax.\nmetadata:\n  model: models\u002Fgemini-3.1-pro-preview\n  last_modified: Thu, 09 Jul 2026 23:13:25 GMT\n---\n\n# Dart Primary Constructors & New Constructor Syntax Skill\n\nUse this skill when helping users write, refactor, or debug code using Dart's **Primary Constructors** feature.\n\n### Dart Version Requirements\n*   **Dart 3.13 and above**: Primary constructors are enabled by default.\n*   **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`:\n```yaml\nanalyzer:\n  enable-experiment:\n    - primary-constructors\n```\n*   **Dart 3.11 and earlier**: Primary constructors are not supported.\n\n---\n\n## 1. Overview\nPrimary 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.\n\n### Key Benefits\n- Combines field declaration, parameter declaration, and initialization into a single declaration known as a declaring parameter declaration.\n- Enables safe reference to constructor parameters in non-late field initializers (Primary Initializer Scope).\n- Allows empty declaration bodies to be represented concisely with a semicolon (`;`).\n- Introduces abbreviated concise syntax for in-body constructors.\n\n---\n\n## 2. Syntax Reference\n\n### 2.1 Basic Class Header Syntax\nTo declare a primary constructor, place a parameter list immediately after the type name (and optional type parameters):\n\n```dart\n\u002F\u002F Declares fields x and y, and a generative constructor Point(this.x, this.y)\nclass Point(var int x, var int y);\n\n\u002F\u002F Declares final fields\nclass PointFinal(final int x, final int y);\n```\n\n### 2.2 Declaring, Initializing, and Plain Parameters\nA primary constructor parameter list distinguishes between three types of parameters:\n1. **Declaring Parameters**: Indicated by the `var` or `final` modifier (e.g., `final int x`). They implicitly create a corresponding instance field in the class.\n2. **Initializing Parameters**: Indicated by the `this.` or `super.` prefix (e.g., `this.x` or `super.x`). They initialize an existing field or a super constructor parameter, respectively.\n3. **Regular Parameters**: Declared without modifiers (e.g., `int y`). They do not become fields and are only available during initialization (e.g., in field initializers or the `this :` initializer list in the class body).\n\n```dart\n\u002F\u002F `x` is a field and a parameter because it has the keyword `final`. In particular, we can use the name `x` in the initializer list in the in-body part of the primary constructor. 'y' is a only parameter because it has neither of the keywords `final` or `var`, but `y` is passed to the super constructor via the `this :` initializer list.\nclass C(final int x, int y) extends Base {\n  this : super(y);\n}\n```\n\nDeclaring parameters and initializing parameters are two ways of achieving the same goal: declaring a class with instance fields which are set in the constructor. Regular parameters are different in that their values are not automatically routed to an instance field.\n\n### 2.3 Constant Primary Constructors\nTo make a primary constructor `const`, place the `const` keyword before the class\u002Ftype name in the declaration header:\n\n```dart\nclass const Point(final int x, final int y);\nextension type const Ext(int x);\nenum const MyEnum(final int x) {\n  entry(1);\n}\n```\n\n### 2.4 Extension Types\nExtension types **must** use primary constructors.\n- The single parameter in the header is the representation field.\n- The representation variable cannot use the `var` modifier (using `var` triggers the `representation_field_modifier` error).\n- The representation variable can optionally use the `final` modifier. If `final` is not present then it is inferred; that is, the parameter is declaring whether or not it's explicitly `final`.\n\n### 2.5 Empty Body Semicolon Shorthand (`;`)\nWhen a class, mixin class, mixin, extension or extension type has an empty body, the `{}` braces can be replaced by a semicolon (`;`):\n\n```dart\nclass C(int x);\nmixin class MC;\nextension type ET(int x);\nmixin M;\nextension Ext on C;\n```\n\n### 2.6 The In-Body Part of a Primary Constructor (`this ...`)\nIf a primary constructor requires assertions or custom field initializations, they can be declared in the body using the `this :` syntax:\n\n```dart\nclass Point(var int x, var int y) {\n  \u002F\u002F Initializer list in class body\n  this : assert(x >= 0), y = y * 2;\n}\n```\n\nYou can also write a constructor body with this syntax (`this {...}`).\n\n### 2.7 Abbreviated Concise Constructor Syntax\nFor constructors declared within the class body, the class name can be omitted and replaced with the `new` or `factory` keywords:\n\n| Traditional Syntax | Abbreviated Concise Syntax |\n| :--- | :--- |\n| `MyClass() {}` | `new() {}` |\n| `MyClass.name() {}` | `new name() {}` |\n| `const MyClass();` | `const new();` |\n| `const MyClass.name();` | `const new name();` |\n| `factory MyClass() => ...` | `factory() => ...` |\n| `factory MyClass.name() => ...` | `factory name() => ...` |\n\n---\n\n## 3. Semantics & Scoping Rules\n\n### 3.1 Primary Initializer Scope\nWhen a primary constructor is declared, its formal parameters are introduced into the **Primary Initializer Scope**. This scope is the current scope for non-late field initializers in the class body and the primary constructor's initializer list (after `this :`).\nThis allows non-late fields to reference constructor parameters directly during declaration:\n  ```dart\n  class DeltaPoint(final int x, int delta) {\n    \u002F\u002F 'x' and 'delta' are in scope here\n    final int y = x + delta;\n  }\n  ```\n\n### 3.2 Late Instance Variables Restriction\nThe primary initializer scope is **not** active for `late` instance variable initializers.\n- Since `late` variables can be evaluated after construction has completed, their initializers cannot safely access constructor parameters.\n- Attempting to access a primary constructor parameter in a `late` field initializer results in a compile-time error.\n\n### 3.3 Shadowing\nPrimary constructor parameters shadow class members (fields) of the same name within the primary initializer scope:\n- In a non-late initializer: `int y = x` refers to parameter `x`.\n- In a `late` initializer: `late int y = x` refers to field `x` (if it exists) because the parameter `x` is out of scope.\n\n### 3.4 Generative Constructor Restrictions\nTo guarantee that the primary constructor (and the associated initializer scope) always executes:\n- A class, mixin class, or enum declaration with a primary constructor **cannot** declare any other non-redirecting generative constructors (except extension types).\n- All other generative constructors declared in the body **must** redirect (directly or indirectly) to the primary constructor.\n\n### 3.5 Parameter Mutation Errors\nPrimary constructor parameters are non-assignable inside the initialization phase.\n- Any assignment to a parameter (e.g., `p = value`, `p++`) inside field initializers or the `this :` initializer list is a compile-time error.\n\n### 3.6 Double Initialization Errors\nInitializing a field twice (e.g., once in the field declaration\u002Finitializer and once in the `this :` initializer list or as an initializing formal) is a compile-time error.\n\n---\n\n## 4. Diagnostics & Troubleshooting\n\nMost errors and lints have quick-fixes, run `dart fix` to fix those violations. For other common errors, fix them using the following table:\n\n| Error \u002F Lint Code | Common Cause | Resolution |\n| :--- | :--- | :--- |\n| **Invalid Late Access** | Referencing a primary constructor parameter inside a `late` field initializer. | Make the field non-late, or pass the value through another non-late field. |\n| `fieldInitializedInInitializerAndDeclaration` | Initializing a variable both in its declaration and in the `this :` list. | Remove one of the initializations. |\n| `nonRedirectingGenerativeConstructorWithPrimary` | Declaring a in-body generative constructor in the body without redirecting to the primary. | Change the in-body constructor such that it is redirecting (e.g. `this(...)`) or remove the in-body constructor. |\n\n---\n\n## 5. Step-by-Step Refactoring Workflows\n\n### Workflow 5.1: Migrating a Class to a Primary Constructor\n\nFollow these steps to migrate a verbose class to the new primary constructor syntax:\n\n1. **Identify Candidate Fields and Constructor**:\n   Locate generative constructors and the fields they initialize. In this case, this would be the `name` and `age` fields.\n   ```dart\n   \u002F\u002F Before\n   class User {\n     final String name;\n     final int age;\n     User(this.name, this.age);\n   }\n   ```\n\n2. **Move Fields to the Header**:\n   Place fields in the header with `final` or `var` modifiers and append a semicolon (`;`) if the body is empty. The `name` and `age` fields are now written the primary constructor as declaring parameters `final String name` and `final int age`, respectively.\n   ```dart\n   \u002F\u002F After\n   class User(final String name, final int age);\n   ```\n\n3. **Handle Custom Initializers and Assertions**:\n   If there is an initializer list or assert block, move it to a `this` block inside the body:\n   ```dart\n   \u002F\u002F Before\n   class Point {\n     final int x;\n     final int y;\n     Point(this.x, this.y) : assert(x >= 0);\n   }\n\n   \u002F\u002F After\n   class Point(final int x, final int y) {\n     this : assert(x >= 0);\n   }\n   ```\n\n4. **Leverage Primary Initializer Scope for Calculations**:\n   If a field value is calculated from parameters, declare it inside the body and assign it directly using the parameters:\n   ```dart\n   \u002F\u002F Before\n   class Rect {\n     final double width;\n     final double height;\n     final double area;\n     Rect(this.width, this.height) : area = width * height;\n   }\n\n   \u002F\u002F After\n   class Rect(final double width, final double height) {\n     \u002F\u002F 'width' and 'height' are in scope here\n     final double area = width * height;\n   }\n   ```\n\n5. **Convert In-Body Constructors to Redirecting**:\n   Ensure all in-body generative constructors redirect to the primary constructor:\n   ```dart\n   \u002F\u002F Before\n   class Point {\n     final int x;\n     final int y;\n     Point(this.x, this.y);\n     Point.zero() : x = 0, y = 0;\n   }\n\n   \u002F\u002F After\n   class Point(final int x, final int y) {\n     new zero() : this(0, 0); \u002F\u002F Redirects to primary\n   }\n   ```\n\n### Workflow 5.2: Applying Abbreviated (Concise) In-Body Constructors\n\nWhen the user prefers to keep the constructor in the class body but wants to reduce verbosity, suggest the abbreviated constructor syntax:\n\n```dart\n\u002F\u002F Before\nclass DatabaseService {\n  final String url;\n  DatabaseService(this.url);\n  DatabaseService.local() : url = 'localhost';\n  factory DatabaseService.create() => DatabaseService('default');\n}\n\n\u002F\u002F After\nclass DatabaseService {\n  final String url;\n  new(this.url); \u002F\u002F Omit class name, use 'new'\n  new local() : url = 'localhost'; \u002F\u002F Use 'new local' for named constructors\n  factory create() => DatabaseService('default'); \u002F\u002F Omit class name from factory\n}\n```\n",{"data":27,"body":31},{"name":4,"description":6,"metadata":28},{"model":29,"last_modified":30},"models\u002Fgemini-3.1-pro-preview","Thu, 09 Jul 2026 23:13:25 GMT",{"type":32,"children":33},"root",[34,43,57,64,114,171,184,188,195,200,206,237,240,246,252,257,308,314,319,422,461,466,472,492,538,544,556,617,630,650,697,710,722,760,772,778,798,953,956,962,968,987,1025,1031,1051,1078,1084,1089,1146,1152,1157,1183,1189,1194,1225,1231,1243,1246,1252,1265,1379,1382,1388,1394,1399,1899,1905,1910,2032],{"type":35,"tag":36,"props":37,"children":39},"element","h1",{"id":38},"dart-primary-constructors-new-constructor-syntax-skill",[40],{"type":41,"value":42},"text","Dart Primary Constructors & New Constructor Syntax Skill",{"type":35,"tag":44,"props":45,"children":46},"p",{},[47,49,55],{"type":41,"value":48},"Use this skill when helping users write, refactor, or debug code using Dart's ",{"type":35,"tag":50,"props":51,"children":52},"strong",{},[53],{"type":41,"value":54},"Primary Constructors",{"type":41,"value":56}," feature.",{"type":35,"tag":58,"props":59,"children":61},"h3",{"id":60},"dart-version-requirements",[62],{"type":41,"value":63},"Dart Version Requirements",{"type":35,"tag":65,"props":66,"children":67},"ul",{},[68,79],{"type":35,"tag":69,"props":70,"children":71},"li",{},[72,77],{"type":35,"tag":50,"props":73,"children":74},{},[75],{"type":41,"value":76},"Dart 3.13 and above",{"type":41,"value":78},": Primary constructors are enabled by default.",{"type":35,"tag":69,"props":80,"children":81},{},[82,87,89,96,98,104,106,112],{"type":35,"tag":50,"props":83,"children":84},{},[85],{"type":41,"value":86},"Dart 3.12",{"type":41,"value":88},": The feature is available but experimental. Users must explicitly enable the experiment flag ",{"type":35,"tag":90,"props":91,"children":93},"code",{"className":92},[],[94],{"type":41,"value":95},"primary-constructors",{"type":41,"value":97}," via ",{"type":35,"tag":90,"props":99,"children":101},{"className":100},[],[102],{"type":41,"value":103},"--enable-experiment=primary-constructors",{"type":41,"value":105}," or in ",{"type":35,"tag":90,"props":107,"children":109},{"className":108},[],[110],{"type":41,"value":111},"analysis_options.yaml",{"type":41,"value":113},":",{"type":35,"tag":115,"props":116,"children":121},"pre",{"className":117,"code":118,"language":119,"meta":120,"style":120},"language-yaml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","analyzer:\n  enable-experiment:\n    - primary-constructors\n","yaml","",[122],{"type":35,"tag":90,"props":123,"children":124},{"__ignoreMap":120},[125,143,156],{"type":35,"tag":126,"props":127,"children":130},"span",{"class":128,"line":129},"line",1,[131,137],{"type":35,"tag":126,"props":132,"children":134},{"style":133},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[135],{"type":41,"value":136},"analyzer",{"type":35,"tag":126,"props":138,"children":140},{"style":139},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[141],{"type":41,"value":142},":\n",{"type":35,"tag":126,"props":144,"children":146},{"class":128,"line":145},2,[147,152],{"type":35,"tag":126,"props":148,"children":149},{"style":133},[150],{"type":41,"value":151},"  enable-experiment",{"type":35,"tag":126,"props":153,"children":154},{"style":139},[155],{"type":41,"value":142},{"type":35,"tag":126,"props":157,"children":159},{"class":128,"line":158},3,[160,165],{"type":35,"tag":126,"props":161,"children":162},{"style":139},[163],{"type":41,"value":164},"    -",{"type":35,"tag":126,"props":166,"children":168},{"style":167},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[169],{"type":41,"value":170}," primary-constructors\n",{"type":35,"tag":65,"props":172,"children":173},{},[174],{"type":35,"tag":69,"props":175,"children":176},{},[177,182],{"type":35,"tag":50,"props":178,"children":179},{},[180],{"type":41,"value":181},"Dart 3.11 and earlier",{"type":41,"value":183},": Primary constructors are not supported.",{"type":35,"tag":185,"props":186,"children":187},"hr",{},[],{"type":35,"tag":189,"props":190,"children":192},"h2",{"id":191},"_1-overview",[193],{"type":41,"value":194},"1. Overview",{"type":35,"tag":44,"props":196,"children":197},{},[198],{"type":41,"value":199},"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.",{"type":35,"tag":58,"props":201,"children":203},{"id":202},"key-benefits",[204],{"type":41,"value":205},"Key Benefits",{"type":35,"tag":65,"props":207,"children":208},{},[209,214,219,232],{"type":35,"tag":69,"props":210,"children":211},{},[212],{"type":41,"value":213},"Combines field declaration, parameter declaration, and initialization into a single declaration known as a declaring parameter declaration.",{"type":35,"tag":69,"props":215,"children":216},{},[217],{"type":41,"value":218},"Enables safe reference to constructor parameters in non-late field initializers (Primary Initializer Scope).",{"type":35,"tag":69,"props":220,"children":221},{},[222,224,230],{"type":41,"value":223},"Allows empty declaration bodies to be represented concisely with a semicolon (",{"type":35,"tag":90,"props":225,"children":227},{"className":226},[],[228],{"type":41,"value":229},";",{"type":41,"value":231},").",{"type":35,"tag":69,"props":233,"children":234},{},[235],{"type":41,"value":236},"Introduces abbreviated concise syntax for in-body constructors.",{"type":35,"tag":185,"props":238,"children":239},{},[],{"type":35,"tag":189,"props":241,"children":243},{"id":242},"_2-syntax-reference",[244],{"type":41,"value":245},"2. Syntax Reference",{"type":35,"tag":58,"props":247,"children":249},{"id":248},"_21-basic-class-header-syntax",[250],{"type":41,"value":251},"2.1 Basic Class Header Syntax",{"type":35,"tag":44,"props":253,"children":254},{},[255],{"type":41,"value":256},"To declare a primary constructor, place a parameter list immediately after the type name (and optional type parameters):",{"type":35,"tag":115,"props":258,"children":261},{"className":259,"code":260,"language":14,"meta":120,"style":120},"language-dart shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Declares fields x and y, and a generative constructor Point(this.x, this.y)\nclass Point(var int x, var int y);\n\n\u002F\u002F Declares final fields\nclass PointFinal(final int x, final int y);\n",[262],{"type":35,"tag":90,"props":263,"children":264},{"__ignoreMap":120},[265,273,281,290,299],{"type":35,"tag":126,"props":266,"children":267},{"class":128,"line":129},[268],{"type":35,"tag":126,"props":269,"children":270},{},[271],{"type":41,"value":272},"\u002F\u002F Declares fields x and y, and a generative constructor Point(this.x, this.y)\n",{"type":35,"tag":126,"props":274,"children":275},{"class":128,"line":145},[276],{"type":35,"tag":126,"props":277,"children":278},{},[279],{"type":41,"value":280},"class Point(var int x, var int y);\n",{"type":35,"tag":126,"props":282,"children":283},{"class":128,"line":158},[284],{"type":35,"tag":126,"props":285,"children":287},{"emptyLinePlaceholder":286},true,[288],{"type":41,"value":289},"\n",{"type":35,"tag":126,"props":291,"children":293},{"class":128,"line":292},4,[294],{"type":35,"tag":126,"props":295,"children":296},{},[297],{"type":41,"value":298},"\u002F\u002F Declares final fields\n",{"type":35,"tag":126,"props":300,"children":302},{"class":128,"line":301},5,[303],{"type":35,"tag":126,"props":304,"children":305},{},[306],{"type":41,"value":307},"class PointFinal(final int x, final int y);\n",{"type":35,"tag":58,"props":309,"children":311},{"id":310},"_22-declaring-initializing-and-plain-parameters",[312],{"type":41,"value":313},"2.2 Declaring, Initializing, and Plain Parameters",{"type":35,"tag":44,"props":315,"children":316},{},[317],{"type":41,"value":318},"A primary constructor parameter list distinguishes between three types of parameters:",{"type":35,"tag":320,"props":321,"children":322},"ol",{},[323,357,396],{"type":35,"tag":69,"props":324,"children":325},{},[326,331,333,339,341,347,349,355],{"type":35,"tag":50,"props":327,"children":328},{},[329],{"type":41,"value":330},"Declaring Parameters",{"type":41,"value":332},": Indicated by the ",{"type":35,"tag":90,"props":334,"children":336},{"className":335},[],[337],{"type":41,"value":338},"var",{"type":41,"value":340}," or ",{"type":35,"tag":90,"props":342,"children":344},{"className":343},[],[345],{"type":41,"value":346},"final",{"type":41,"value":348}," modifier (e.g., ",{"type":35,"tag":90,"props":350,"children":352},{"className":351},[],[353],{"type":41,"value":354},"final int x",{"type":41,"value":356},"). They implicitly create a corresponding instance field in the class.",{"type":35,"tag":69,"props":358,"children":359},{},[360,365,366,372,373,379,381,387,388,394],{"type":35,"tag":50,"props":361,"children":362},{},[363],{"type":41,"value":364},"Initializing Parameters",{"type":41,"value":332},{"type":35,"tag":90,"props":367,"children":369},{"className":368},[],[370],{"type":41,"value":371},"this.",{"type":41,"value":340},{"type":35,"tag":90,"props":374,"children":376},{"className":375},[],[377],{"type":41,"value":378},"super.",{"type":41,"value":380}," prefix (e.g., ",{"type":35,"tag":90,"props":382,"children":384},{"className":383},[],[385],{"type":41,"value":386},"this.x",{"type":41,"value":340},{"type":35,"tag":90,"props":389,"children":391},{"className":390},[],[392],{"type":41,"value":393},"super.x",{"type":41,"value":395},"). They initialize an existing field or a super constructor parameter, respectively.",{"type":35,"tag":69,"props":397,"children":398},{},[399,404,406,412,414,420],{"type":35,"tag":50,"props":400,"children":401},{},[402],{"type":41,"value":403},"Regular Parameters",{"type":41,"value":405},": Declared without modifiers (e.g., ",{"type":35,"tag":90,"props":407,"children":409},{"className":408},[],[410],{"type":41,"value":411},"int y",{"type":41,"value":413},"). They do not become fields and are only available during initialization (e.g., in field initializers or the ",{"type":35,"tag":90,"props":415,"children":417},{"className":416},[],[418],{"type":41,"value":419},"this :",{"type":41,"value":421}," initializer list in the class body).",{"type":35,"tag":115,"props":423,"children":425},{"className":259,"code":424,"language":14,"meta":120,"style":120},"\u002F\u002F `x` is a field and a parameter because it has the keyword `final`. In particular, we can use the name `x` in the initializer list in the in-body part of the primary constructor. 'y' is a only parameter because it has neither of the keywords `final` or `var`, but `y` is passed to the super constructor via the `this :` initializer list.\nclass C(final int x, int y) extends Base {\n  this : super(y);\n}\n",[426],{"type":35,"tag":90,"props":427,"children":428},{"__ignoreMap":120},[429,437,445,453],{"type":35,"tag":126,"props":430,"children":431},{"class":128,"line":129},[432],{"type":35,"tag":126,"props":433,"children":434},{},[435],{"type":41,"value":436},"\u002F\u002F `x` is a field and a parameter because it has the keyword `final`. In particular, we can use the name `x` in the initializer list in the in-body part of the primary constructor. 'y' is a only parameter because it has neither of the keywords `final` or `var`, but `y` is passed to the super constructor via the `this :` initializer list.\n",{"type":35,"tag":126,"props":438,"children":439},{"class":128,"line":145},[440],{"type":35,"tag":126,"props":441,"children":442},{},[443],{"type":41,"value":444},"class C(final int x, int y) extends Base {\n",{"type":35,"tag":126,"props":446,"children":447},{"class":128,"line":158},[448],{"type":35,"tag":126,"props":449,"children":450},{},[451],{"type":41,"value":452},"  this : super(y);\n",{"type":35,"tag":126,"props":454,"children":455},{"class":128,"line":292},[456],{"type":35,"tag":126,"props":457,"children":458},{},[459],{"type":41,"value":460},"}\n",{"type":35,"tag":44,"props":462,"children":463},{},[464],{"type":41,"value":465},"Declaring parameters and initializing parameters are two ways of achieving the same goal: declaring a class with instance fields which are set in the constructor. Regular parameters are different in that their values are not automatically routed to an instance field.",{"type":35,"tag":58,"props":467,"children":469},{"id":468},"_23-constant-primary-constructors",[470],{"type":41,"value":471},"2.3 Constant Primary Constructors",{"type":35,"tag":44,"props":473,"children":474},{},[475,477,483,485,490],{"type":41,"value":476},"To make a primary constructor ",{"type":35,"tag":90,"props":478,"children":480},{"className":479},[],[481],{"type":41,"value":482},"const",{"type":41,"value":484},", place the ",{"type":35,"tag":90,"props":486,"children":488},{"className":487},[],[489],{"type":41,"value":482},{"type":41,"value":491}," keyword before the class\u002Ftype name in the declaration header:",{"type":35,"tag":115,"props":493,"children":495},{"className":259,"code":494,"language":14,"meta":120,"style":120},"class const Point(final int x, final int y);\nextension type const Ext(int x);\nenum const MyEnum(final int x) {\n  entry(1);\n}\n",[496],{"type":35,"tag":90,"props":497,"children":498},{"__ignoreMap":120},[499,507,515,523,531],{"type":35,"tag":126,"props":500,"children":501},{"class":128,"line":129},[502],{"type":35,"tag":126,"props":503,"children":504},{},[505],{"type":41,"value":506},"class const Point(final int x, final int y);\n",{"type":35,"tag":126,"props":508,"children":509},{"class":128,"line":145},[510],{"type":35,"tag":126,"props":511,"children":512},{},[513],{"type":41,"value":514},"extension type const Ext(int x);\n",{"type":35,"tag":126,"props":516,"children":517},{"class":128,"line":158},[518],{"type":35,"tag":126,"props":519,"children":520},{},[521],{"type":41,"value":522},"enum const MyEnum(final int x) {\n",{"type":35,"tag":126,"props":524,"children":525},{"class":128,"line":292},[526],{"type":35,"tag":126,"props":527,"children":528},{},[529],{"type":41,"value":530},"  entry(1);\n",{"type":35,"tag":126,"props":532,"children":533},{"class":128,"line":301},[534],{"type":35,"tag":126,"props":535,"children":536},{},[537],{"type":41,"value":460},{"type":35,"tag":58,"props":539,"children":541},{"id":540},"_24-extension-types",[542],{"type":41,"value":543},"2.4 Extension Types",{"type":35,"tag":44,"props":545,"children":546},{},[547,549,554],{"type":41,"value":548},"Extension types ",{"type":35,"tag":50,"props":550,"children":551},{},[552],{"type":41,"value":553},"must",{"type":41,"value":555}," use primary constructors.",{"type":35,"tag":65,"props":557,"children":558},{},[559,564,591],{"type":35,"tag":69,"props":560,"children":561},{},[562],{"type":41,"value":563},"The single parameter in the header is the representation field.",{"type":35,"tag":69,"props":565,"children":566},{},[567,569,574,576,581,583,589],{"type":41,"value":568},"The representation variable cannot use the ",{"type":35,"tag":90,"props":570,"children":572},{"className":571},[],[573],{"type":41,"value":338},{"type":41,"value":575}," modifier (using ",{"type":35,"tag":90,"props":577,"children":579},{"className":578},[],[580],{"type":41,"value":338},{"type":41,"value":582}," triggers the ",{"type":35,"tag":90,"props":584,"children":586},{"className":585},[],[587],{"type":41,"value":588},"representation_field_modifier",{"type":41,"value":590}," error).",{"type":35,"tag":69,"props":592,"children":593},{},[594,596,601,603,608,610,615],{"type":41,"value":595},"The representation variable can optionally use the ",{"type":35,"tag":90,"props":597,"children":599},{"className":598},[],[600],{"type":41,"value":346},{"type":41,"value":602}," modifier. If ",{"type":35,"tag":90,"props":604,"children":606},{"className":605},[],[607],{"type":41,"value":346},{"type":41,"value":609}," is not present then it is inferred; that is, the parameter is declaring whether or not it's explicitly ",{"type":35,"tag":90,"props":611,"children":613},{"className":612},[],[614],{"type":41,"value":346},{"type":41,"value":616},".",{"type":35,"tag":58,"props":618,"children":620},{"id":619},"_25-empty-body-semicolon-shorthand",[621,623,628],{"type":41,"value":622},"2.5 Empty Body Semicolon Shorthand (",{"type":35,"tag":90,"props":624,"children":626},{"className":625},[],[627],{"type":41,"value":229},{"type":41,"value":629},")",{"type":35,"tag":44,"props":631,"children":632},{},[633,635,641,643,648],{"type":41,"value":634},"When a class, mixin class, mixin, extension or extension type has an empty body, the ",{"type":35,"tag":90,"props":636,"children":638},{"className":637},[],[639],{"type":41,"value":640},"{}",{"type":41,"value":642}," braces can be replaced by a semicolon (",{"type":35,"tag":90,"props":644,"children":646},{"className":645},[],[647],{"type":41,"value":229},{"type":41,"value":649},"):",{"type":35,"tag":115,"props":651,"children":653},{"className":259,"code":652,"language":14,"meta":120,"style":120},"class C(int x);\nmixin class MC;\nextension type ET(int x);\nmixin M;\nextension Ext on C;\n",[654],{"type":35,"tag":90,"props":655,"children":656},{"__ignoreMap":120},[657,665,673,681,689],{"type":35,"tag":126,"props":658,"children":659},{"class":128,"line":129},[660],{"type":35,"tag":126,"props":661,"children":662},{},[663],{"type":41,"value":664},"class C(int x);\n",{"type":35,"tag":126,"props":666,"children":667},{"class":128,"line":145},[668],{"type":35,"tag":126,"props":669,"children":670},{},[671],{"type":41,"value":672},"mixin class MC;\n",{"type":35,"tag":126,"props":674,"children":675},{"class":128,"line":158},[676],{"type":35,"tag":126,"props":677,"children":678},{},[679],{"type":41,"value":680},"extension type ET(int x);\n",{"type":35,"tag":126,"props":682,"children":683},{"class":128,"line":292},[684],{"type":35,"tag":126,"props":685,"children":686},{},[687],{"type":41,"value":688},"mixin M;\n",{"type":35,"tag":126,"props":690,"children":691},{"class":128,"line":301},[692],{"type":35,"tag":126,"props":693,"children":694},{},[695],{"type":41,"value":696},"extension Ext on C;\n",{"type":35,"tag":58,"props":698,"children":700},{"id":699},"_26-the-in-body-part-of-a-primary-constructor-this",[701,703,709],{"type":41,"value":702},"2.6 The In-Body Part of a Primary Constructor (",{"type":35,"tag":90,"props":704,"children":706},{"className":705},[],[707],{"type":41,"value":708},"this ...",{"type":41,"value":629},{"type":35,"tag":44,"props":711,"children":712},{},[713,715,720],{"type":41,"value":714},"If a primary constructor requires assertions or custom field initializations, they can be declared in the body using the ",{"type":35,"tag":90,"props":716,"children":718},{"className":717},[],[719],{"type":41,"value":419},{"type":41,"value":721}," syntax:",{"type":35,"tag":115,"props":723,"children":725},{"className":259,"code":724,"language":14,"meta":120,"style":120},"class Point(var int x, var int y) {\n  \u002F\u002F Initializer list in class body\n  this : assert(x >= 0), y = y * 2;\n}\n",[726],{"type":35,"tag":90,"props":727,"children":728},{"__ignoreMap":120},[729,737,745,753],{"type":35,"tag":126,"props":730,"children":731},{"class":128,"line":129},[732],{"type":35,"tag":126,"props":733,"children":734},{},[735],{"type":41,"value":736},"class Point(var int x, var int y) {\n",{"type":35,"tag":126,"props":738,"children":739},{"class":128,"line":145},[740],{"type":35,"tag":126,"props":741,"children":742},{},[743],{"type":41,"value":744},"  \u002F\u002F Initializer list in class body\n",{"type":35,"tag":126,"props":746,"children":747},{"class":128,"line":158},[748],{"type":35,"tag":126,"props":749,"children":750},{},[751],{"type":41,"value":752},"  this : assert(x >= 0), y = y * 2;\n",{"type":35,"tag":126,"props":754,"children":755},{"class":128,"line":292},[756],{"type":35,"tag":126,"props":757,"children":758},{},[759],{"type":41,"value":460},{"type":35,"tag":44,"props":761,"children":762},{},[763,765,771],{"type":41,"value":764},"You can also write a constructor body with this syntax (",{"type":35,"tag":90,"props":766,"children":768},{"className":767},[],[769],{"type":41,"value":770},"this {...}",{"type":41,"value":231},{"type":35,"tag":58,"props":773,"children":775},{"id":774},"_27-abbreviated-concise-constructor-syntax",[776],{"type":41,"value":777},"2.7 Abbreviated Concise Constructor Syntax",{"type":35,"tag":44,"props":779,"children":780},{},[781,783,789,790,796],{"type":41,"value":782},"For constructors declared within the class body, the class name can be omitted and replaced with the ",{"type":35,"tag":90,"props":784,"children":786},{"className":785},[],[787],{"type":41,"value":788},"new",{"type":41,"value":340},{"type":35,"tag":90,"props":791,"children":793},{"className":792},[],[794],{"type":41,"value":795},"factory",{"type":41,"value":797}," keywords:",{"type":35,"tag":799,"props":800,"children":801},"table",{},[802,822],{"type":35,"tag":803,"props":804,"children":805},"thead",{},[806],{"type":35,"tag":807,"props":808,"children":809},"tr",{},[810,817],{"type":35,"tag":811,"props":812,"children":814},"th",{"align":813},"left",[815],{"type":41,"value":816},"Traditional Syntax",{"type":35,"tag":811,"props":818,"children":819},{"align":813},[820],{"type":41,"value":821},"Abbreviated Concise Syntax",{"type":35,"tag":823,"props":824,"children":825},"tbody",{},[826,848,869,890,911,932],{"type":35,"tag":807,"props":827,"children":828},{},[829,839],{"type":35,"tag":830,"props":831,"children":832},"td",{"align":813},[833],{"type":35,"tag":90,"props":834,"children":836},{"className":835},[],[837],{"type":41,"value":838},"MyClass() {}",{"type":35,"tag":830,"props":840,"children":841},{"align":813},[842],{"type":35,"tag":90,"props":843,"children":845},{"className":844},[],[846],{"type":41,"value":847},"new() {}",{"type":35,"tag":807,"props":849,"children":850},{},[851,860],{"type":35,"tag":830,"props":852,"children":853},{"align":813},[854],{"type":35,"tag":90,"props":855,"children":857},{"className":856},[],[858],{"type":41,"value":859},"MyClass.name() {}",{"type":35,"tag":830,"props":861,"children":862},{"align":813},[863],{"type":35,"tag":90,"props":864,"children":866},{"className":865},[],[867],{"type":41,"value":868},"new name() {}",{"type":35,"tag":807,"props":870,"children":871},{},[872,881],{"type":35,"tag":830,"props":873,"children":874},{"align":813},[875],{"type":35,"tag":90,"props":876,"children":878},{"className":877},[],[879],{"type":41,"value":880},"const MyClass();",{"type":35,"tag":830,"props":882,"children":883},{"align":813},[884],{"type":35,"tag":90,"props":885,"children":887},{"className":886},[],[888],{"type":41,"value":889},"const new();",{"type":35,"tag":807,"props":891,"children":892},{},[893,902],{"type":35,"tag":830,"props":894,"children":895},{"align":813},[896],{"type":35,"tag":90,"props":897,"children":899},{"className":898},[],[900],{"type":41,"value":901},"const MyClass.name();",{"type":35,"tag":830,"props":903,"children":904},{"align":813},[905],{"type":35,"tag":90,"props":906,"children":908},{"className":907},[],[909],{"type":41,"value":910},"const new name();",{"type":35,"tag":807,"props":912,"children":913},{},[914,923],{"type":35,"tag":830,"props":915,"children":916},{"align":813},[917],{"type":35,"tag":90,"props":918,"children":920},{"className":919},[],[921],{"type":41,"value":922},"factory MyClass() => ...",{"type":35,"tag":830,"props":924,"children":925},{"align":813},[926],{"type":35,"tag":90,"props":927,"children":929},{"className":928},[],[930],{"type":41,"value":931},"factory() => ...",{"type":35,"tag":807,"props":933,"children":934},{},[935,944],{"type":35,"tag":830,"props":936,"children":937},{"align":813},[938],{"type":35,"tag":90,"props":939,"children":941},{"className":940},[],[942],{"type":41,"value":943},"factory MyClass.name() => ...",{"type":35,"tag":830,"props":945,"children":946},{"align":813},[947],{"type":35,"tag":90,"props":948,"children":950},{"className":949},[],[951],{"type":41,"value":952},"factory name() => ...",{"type":35,"tag":185,"props":954,"children":955},{},[],{"type":35,"tag":189,"props":957,"children":959},{"id":958},"_3-semantics-scoping-rules",[960],{"type":41,"value":961},"3. Semantics & Scoping Rules",{"type":35,"tag":58,"props":963,"children":965},{"id":964},"_31-primary-initializer-scope",[966],{"type":41,"value":967},"3.1 Primary Initializer Scope",{"type":35,"tag":44,"props":969,"children":970},{},[971,973,978,980,985],{"type":41,"value":972},"When a primary constructor is declared, its formal parameters are introduced into the ",{"type":35,"tag":50,"props":974,"children":975},{},[976],{"type":41,"value":977},"Primary Initializer Scope",{"type":41,"value":979},". This scope is the current scope for non-late field initializers in the class body and the primary constructor's initializer list (after ",{"type":35,"tag":90,"props":981,"children":983},{"className":982},[],[984],{"type":41,"value":419},{"type":41,"value":986},").\nThis allows non-late fields to reference constructor parameters directly during declaration:",{"type":35,"tag":115,"props":988,"children":990},{"className":259,"code":989,"language":14,"meta":120,"style":120},"class DeltaPoint(final int x, int delta) {\n  \u002F\u002F 'x' and 'delta' are in scope here\n  final int y = x + delta;\n}\n",[991],{"type":35,"tag":90,"props":992,"children":993},{"__ignoreMap":120},[994,1002,1010,1018],{"type":35,"tag":126,"props":995,"children":996},{"class":128,"line":129},[997],{"type":35,"tag":126,"props":998,"children":999},{},[1000],{"type":41,"value":1001},"class DeltaPoint(final int x, int delta) {\n",{"type":35,"tag":126,"props":1003,"children":1004},{"class":128,"line":145},[1005],{"type":35,"tag":126,"props":1006,"children":1007},{},[1008],{"type":41,"value":1009},"  \u002F\u002F 'x' and 'delta' are in scope here\n",{"type":35,"tag":126,"props":1011,"children":1012},{"class":128,"line":158},[1013],{"type":35,"tag":126,"props":1014,"children":1015},{},[1016],{"type":41,"value":1017},"  final int y = x + delta;\n",{"type":35,"tag":126,"props":1019,"children":1020},{"class":128,"line":292},[1021],{"type":35,"tag":126,"props":1022,"children":1023},{},[1024],{"type":41,"value":460},{"type":35,"tag":58,"props":1026,"children":1028},{"id":1027},"_32-late-instance-variables-restriction",[1029],{"type":41,"value":1030},"3.2 Late Instance Variables Restriction",{"type":35,"tag":44,"props":1032,"children":1033},{},[1034,1036,1041,1043,1049],{"type":41,"value":1035},"The primary initializer scope is ",{"type":35,"tag":50,"props":1037,"children":1038},{},[1039],{"type":41,"value":1040},"not",{"type":41,"value":1042}," active for ",{"type":35,"tag":90,"props":1044,"children":1046},{"className":1045},[],[1047],{"type":41,"value":1048},"late",{"type":41,"value":1050}," instance variable initializers.",{"type":35,"tag":65,"props":1052,"children":1053},{},[1054,1066],{"type":35,"tag":69,"props":1055,"children":1056},{},[1057,1059,1064],{"type":41,"value":1058},"Since ",{"type":35,"tag":90,"props":1060,"children":1062},{"className":1061},[],[1063],{"type":41,"value":1048},{"type":41,"value":1065}," variables can be evaluated after construction has completed, their initializers cannot safely access constructor parameters.",{"type":35,"tag":69,"props":1067,"children":1068},{},[1069,1071,1076],{"type":41,"value":1070},"Attempting to access a primary constructor parameter in a ",{"type":35,"tag":90,"props":1072,"children":1074},{"className":1073},[],[1075],{"type":41,"value":1048},{"type":41,"value":1077}," field initializer results in a compile-time error.",{"type":35,"tag":58,"props":1079,"children":1081},{"id":1080},"_33-shadowing",[1082],{"type":41,"value":1083},"3.3 Shadowing",{"type":35,"tag":44,"props":1085,"children":1086},{},[1087],{"type":41,"value":1088},"Primary constructor parameters shadow class members (fields) of the same name within the primary initializer scope:",{"type":35,"tag":65,"props":1090,"children":1091},{},[1092,1112],{"type":35,"tag":69,"props":1093,"children":1094},{},[1095,1097,1103,1105,1111],{"type":41,"value":1096},"In a non-late initializer: ",{"type":35,"tag":90,"props":1098,"children":1100},{"className":1099},[],[1101],{"type":41,"value":1102},"int y = x",{"type":41,"value":1104}," refers to parameter ",{"type":35,"tag":90,"props":1106,"children":1108},{"className":1107},[],[1109],{"type":41,"value":1110},"x",{"type":41,"value":616},{"type":35,"tag":69,"props":1113,"children":1114},{},[1115,1117,1122,1124,1130,1132,1137,1139,1144],{"type":41,"value":1116},"In a ",{"type":35,"tag":90,"props":1118,"children":1120},{"className":1119},[],[1121],{"type":41,"value":1048},{"type":41,"value":1123}," initializer: ",{"type":35,"tag":90,"props":1125,"children":1127},{"className":1126},[],[1128],{"type":41,"value":1129},"late int y = x",{"type":41,"value":1131}," refers to field ",{"type":35,"tag":90,"props":1133,"children":1135},{"className":1134},[],[1136],{"type":41,"value":1110},{"type":41,"value":1138}," (if it exists) because the parameter ",{"type":35,"tag":90,"props":1140,"children":1142},{"className":1141},[],[1143],{"type":41,"value":1110},{"type":41,"value":1145}," is out of scope.",{"type":35,"tag":58,"props":1147,"children":1149},{"id":1148},"_34-generative-constructor-restrictions",[1150],{"type":41,"value":1151},"3.4 Generative Constructor Restrictions",{"type":35,"tag":44,"props":1153,"children":1154},{},[1155],{"type":41,"value":1156},"To guarantee that the primary constructor (and the associated initializer scope) always executes:",{"type":35,"tag":65,"props":1158,"children":1159},{},[1160,1172],{"type":35,"tag":69,"props":1161,"children":1162},{},[1163,1165,1170],{"type":41,"value":1164},"A class, mixin class, or enum declaration with a primary constructor ",{"type":35,"tag":50,"props":1166,"children":1167},{},[1168],{"type":41,"value":1169},"cannot",{"type":41,"value":1171}," declare any other non-redirecting generative constructors (except extension types).",{"type":35,"tag":69,"props":1173,"children":1174},{},[1175,1177,1181],{"type":41,"value":1176},"All other generative constructors declared in the body ",{"type":35,"tag":50,"props":1178,"children":1179},{},[1180],{"type":41,"value":553},{"type":41,"value":1182}," redirect (directly or indirectly) to the primary constructor.",{"type":35,"tag":58,"props":1184,"children":1186},{"id":1185},"_35-parameter-mutation-errors",[1187],{"type":41,"value":1188},"3.5 Parameter Mutation Errors",{"type":35,"tag":44,"props":1190,"children":1191},{},[1192],{"type":41,"value":1193},"Primary constructor parameters are non-assignable inside the initialization phase.",{"type":35,"tag":65,"props":1195,"children":1196},{},[1197],{"type":35,"tag":69,"props":1198,"children":1199},{},[1200,1202,1208,1210,1216,1218,1223],{"type":41,"value":1201},"Any assignment to a parameter (e.g., ",{"type":35,"tag":90,"props":1203,"children":1205},{"className":1204},[],[1206],{"type":41,"value":1207},"p = value",{"type":41,"value":1209},", ",{"type":35,"tag":90,"props":1211,"children":1213},{"className":1212},[],[1214],{"type":41,"value":1215},"p++",{"type":41,"value":1217},") inside field initializers or the ",{"type":35,"tag":90,"props":1219,"children":1221},{"className":1220},[],[1222],{"type":41,"value":419},{"type":41,"value":1224}," initializer list is a compile-time error.",{"type":35,"tag":58,"props":1226,"children":1228},{"id":1227},"_36-double-initialization-errors",[1229],{"type":41,"value":1230},"3.6 Double Initialization Errors",{"type":35,"tag":44,"props":1232,"children":1233},{},[1234,1236,1241],{"type":41,"value":1235},"Initializing a field twice (e.g., once in the field declaration\u002Finitializer and once in the ",{"type":35,"tag":90,"props":1237,"children":1239},{"className":1238},[],[1240],{"type":41,"value":419},{"type":41,"value":1242}," initializer list or as an initializing formal) is a compile-time error.",{"type":35,"tag":185,"props":1244,"children":1245},{},[],{"type":35,"tag":189,"props":1247,"children":1249},{"id":1248},"_4-diagnostics-troubleshooting",[1250],{"type":41,"value":1251},"4. Diagnostics & Troubleshooting",{"type":35,"tag":44,"props":1253,"children":1254},{},[1255,1257,1263],{"type":41,"value":1256},"Most errors and lints have quick-fixes, run ",{"type":35,"tag":90,"props":1258,"children":1260},{"className":1259},[],[1261],{"type":41,"value":1262},"dart fix",{"type":41,"value":1264}," to fix those violations. For other common errors, fix them using the following table:",{"type":35,"tag":799,"props":1266,"children":1267},{},[1268,1289],{"type":35,"tag":803,"props":1269,"children":1270},{},[1271],{"type":35,"tag":807,"props":1272,"children":1273},{},[1274,1279,1284],{"type":35,"tag":811,"props":1275,"children":1276},{"align":813},[1277],{"type":41,"value":1278},"Error \u002F Lint Code",{"type":35,"tag":811,"props":1280,"children":1281},{"align":813},[1282],{"type":41,"value":1283},"Common Cause",{"type":35,"tag":811,"props":1285,"children":1286},{"align":813},[1287],{"type":41,"value":1288},"Resolution",{"type":35,"tag":823,"props":1290,"children":1291},{},[1292,1320,1349],{"type":35,"tag":807,"props":1293,"children":1294},{},[1295,1303,1315],{"type":35,"tag":830,"props":1296,"children":1297},{"align":813},[1298],{"type":35,"tag":50,"props":1299,"children":1300},{},[1301],{"type":41,"value":1302},"Invalid Late Access",{"type":35,"tag":830,"props":1304,"children":1305},{"align":813},[1306,1308,1313],{"type":41,"value":1307},"Referencing a primary constructor parameter inside a ",{"type":35,"tag":90,"props":1309,"children":1311},{"className":1310},[],[1312],{"type":41,"value":1048},{"type":41,"value":1314}," field initializer.",{"type":35,"tag":830,"props":1316,"children":1317},{"align":813},[1318],{"type":41,"value":1319},"Make the field non-late, or pass the value through another non-late field.",{"type":35,"tag":807,"props":1321,"children":1322},{},[1323,1332,1344],{"type":35,"tag":830,"props":1324,"children":1325},{"align":813},[1326],{"type":35,"tag":90,"props":1327,"children":1329},{"className":1328},[],[1330],{"type":41,"value":1331},"fieldInitializedInInitializerAndDeclaration",{"type":35,"tag":830,"props":1333,"children":1334},{"align":813},[1335,1337,1342],{"type":41,"value":1336},"Initializing a variable both in its declaration and in the ",{"type":35,"tag":90,"props":1338,"children":1340},{"className":1339},[],[1341],{"type":41,"value":419},{"type":41,"value":1343}," list.",{"type":35,"tag":830,"props":1345,"children":1346},{"align":813},[1347],{"type":41,"value":1348},"Remove one of the initializations.",{"type":35,"tag":807,"props":1350,"children":1351},{},[1352,1361,1366],{"type":35,"tag":830,"props":1353,"children":1354},{"align":813},[1355],{"type":35,"tag":90,"props":1356,"children":1358},{"className":1357},[],[1359],{"type":41,"value":1360},"nonRedirectingGenerativeConstructorWithPrimary",{"type":35,"tag":830,"props":1362,"children":1363},{"align":813},[1364],{"type":41,"value":1365},"Declaring a in-body generative constructor in the body without redirecting to the primary.",{"type":35,"tag":830,"props":1367,"children":1368},{"align":813},[1369,1371,1377],{"type":41,"value":1370},"Change the in-body constructor such that it is redirecting (e.g. ",{"type":35,"tag":90,"props":1372,"children":1374},{"className":1373},[],[1375],{"type":41,"value":1376},"this(...)",{"type":41,"value":1378},") or remove the in-body constructor.",{"type":35,"tag":185,"props":1380,"children":1381},{},[],{"type":35,"tag":189,"props":1383,"children":1385},{"id":1384},"_5-step-by-step-refactoring-workflows",[1386],{"type":41,"value":1387},"5. Step-by-Step Refactoring Workflows",{"type":35,"tag":58,"props":1389,"children":1391},{"id":1390},"workflow-51-migrating-a-class-to-a-primary-constructor",[1392],{"type":41,"value":1393},"Workflow 5.1: Migrating a Class to a Primary Constructor",{"type":35,"tag":44,"props":1395,"children":1396},{},[1397],{"type":41,"value":1398},"Follow these steps to migrate a verbose class to the new primary constructor syntax:",{"type":35,"tag":320,"props":1400,"children":1401},{},[1402,1483,1564,1677,1795],{"type":35,"tag":69,"props":1403,"children":1404},{},[1405,1410,1412,1418,1420,1426,1428],{"type":35,"tag":50,"props":1406,"children":1407},{},[1408],{"type":41,"value":1409},"Identify Candidate Fields and Constructor",{"type":41,"value":1411},":\nLocate generative constructors and the fields they initialize. In this case, this would be the ",{"type":35,"tag":90,"props":1413,"children":1415},{"className":1414},[],[1416],{"type":41,"value":1417},"name",{"type":41,"value":1419}," and ",{"type":35,"tag":90,"props":1421,"children":1423},{"className":1422},[],[1424],{"type":41,"value":1425},"age",{"type":41,"value":1427}," fields.",{"type":35,"tag":115,"props":1429,"children":1431},{"className":259,"code":1430,"language":14,"meta":120,"style":120},"\u002F\u002F Before\nclass User {\n  final String name;\n  final int age;\n  User(this.name, this.age);\n}\n",[1432],{"type":35,"tag":90,"props":1433,"children":1434},{"__ignoreMap":120},[1435,1443,1451,1459,1467,1475],{"type":35,"tag":126,"props":1436,"children":1437},{"class":128,"line":129},[1438],{"type":35,"tag":126,"props":1439,"children":1440},{},[1441],{"type":41,"value":1442},"\u002F\u002F Before\n",{"type":35,"tag":126,"props":1444,"children":1445},{"class":128,"line":145},[1446],{"type":35,"tag":126,"props":1447,"children":1448},{},[1449],{"type":41,"value":1450},"class User {\n",{"type":35,"tag":126,"props":1452,"children":1453},{"class":128,"line":158},[1454],{"type":35,"tag":126,"props":1455,"children":1456},{},[1457],{"type":41,"value":1458},"  final String name;\n",{"type":35,"tag":126,"props":1460,"children":1461},{"class":128,"line":292},[1462],{"type":35,"tag":126,"props":1463,"children":1464},{},[1465],{"type":41,"value":1466},"  final int age;\n",{"type":35,"tag":126,"props":1468,"children":1469},{"class":128,"line":301},[1470],{"type":35,"tag":126,"props":1471,"children":1472},{},[1473],{"type":41,"value":1474},"  User(this.name, this.age);\n",{"type":35,"tag":126,"props":1476,"children":1478},{"class":128,"line":1477},6,[1479],{"type":35,"tag":126,"props":1480,"children":1481},{},[1482],{"type":41,"value":460},{"type":35,"tag":69,"props":1484,"children":1485},{},[1486,1491,1493,1498,1499,1504,1506,1511,1513,1518,1519,1524,1526,1532,1533,1539,1541],{"type":35,"tag":50,"props":1487,"children":1488},{},[1489],{"type":41,"value":1490},"Move Fields to the Header",{"type":41,"value":1492},":\nPlace fields in the header with ",{"type":35,"tag":90,"props":1494,"children":1496},{"className":1495},[],[1497],{"type":41,"value":346},{"type":41,"value":340},{"type":35,"tag":90,"props":1500,"children":1502},{"className":1501},[],[1503],{"type":41,"value":338},{"type":41,"value":1505}," modifiers and append a semicolon (",{"type":35,"tag":90,"props":1507,"children":1509},{"className":1508},[],[1510],{"type":41,"value":229},{"type":41,"value":1512},") if the body is empty. The ",{"type":35,"tag":90,"props":1514,"children":1516},{"className":1515},[],[1517],{"type":41,"value":1417},{"type":41,"value":1419},{"type":35,"tag":90,"props":1520,"children":1522},{"className":1521},[],[1523],{"type":41,"value":1425},{"type":41,"value":1525}," fields are now written the primary constructor as declaring parameters ",{"type":35,"tag":90,"props":1527,"children":1529},{"className":1528},[],[1530],{"type":41,"value":1531},"final String name",{"type":41,"value":1419},{"type":35,"tag":90,"props":1534,"children":1536},{"className":1535},[],[1537],{"type":41,"value":1538},"final int age",{"type":41,"value":1540},", respectively.",{"type":35,"tag":115,"props":1542,"children":1544},{"className":259,"code":1543,"language":14,"meta":120,"style":120},"\u002F\u002F After\nclass User(final String name, final int age);\n",[1545],{"type":35,"tag":90,"props":1546,"children":1547},{"__ignoreMap":120},[1548,1556],{"type":35,"tag":126,"props":1549,"children":1550},{"class":128,"line":129},[1551],{"type":35,"tag":126,"props":1552,"children":1553},{},[1554],{"type":41,"value":1555},"\u002F\u002F After\n",{"type":35,"tag":126,"props":1557,"children":1558},{"class":128,"line":145},[1559],{"type":35,"tag":126,"props":1560,"children":1561},{},[1562],{"type":41,"value":1563},"class User(final String name, final int age);\n",{"type":35,"tag":69,"props":1565,"children":1566},{},[1567,1572,1574,1580,1582],{"type":35,"tag":50,"props":1568,"children":1569},{},[1570],{"type":41,"value":1571},"Handle Custom Initializers and Assertions",{"type":41,"value":1573},":\nIf there is an initializer list or assert block, move it to a ",{"type":35,"tag":90,"props":1575,"children":1577},{"className":1576},[],[1578],{"type":41,"value":1579},"this",{"type":41,"value":1581}," block inside the body:",{"type":35,"tag":115,"props":1583,"children":1585},{"className":259,"code":1584,"language":14,"meta":120,"style":120},"\u002F\u002F Before\nclass Point {\n  final int x;\n  final int y;\n  Point(this.x, this.y) : assert(x >= 0);\n}\n\n\u002F\u002F After\nclass Point(final int x, final int y) {\n  this : assert(x >= 0);\n}\n",[1586],{"type":35,"tag":90,"props":1587,"children":1588},{"__ignoreMap":120},[1589,1596,1604,1612,1620,1628,1635,1643,1651,1660,1669],{"type":35,"tag":126,"props":1590,"children":1591},{"class":128,"line":129},[1592],{"type":35,"tag":126,"props":1593,"children":1594},{},[1595],{"type":41,"value":1442},{"type":35,"tag":126,"props":1597,"children":1598},{"class":128,"line":145},[1599],{"type":35,"tag":126,"props":1600,"children":1601},{},[1602],{"type":41,"value":1603},"class Point {\n",{"type":35,"tag":126,"props":1605,"children":1606},{"class":128,"line":158},[1607],{"type":35,"tag":126,"props":1608,"children":1609},{},[1610],{"type":41,"value":1611},"  final int x;\n",{"type":35,"tag":126,"props":1613,"children":1614},{"class":128,"line":292},[1615],{"type":35,"tag":126,"props":1616,"children":1617},{},[1618],{"type":41,"value":1619},"  final int y;\n",{"type":35,"tag":126,"props":1621,"children":1622},{"class":128,"line":301},[1623],{"type":35,"tag":126,"props":1624,"children":1625},{},[1626],{"type":41,"value":1627},"  Point(this.x, this.y) : assert(x >= 0);\n",{"type":35,"tag":126,"props":1629,"children":1630},{"class":128,"line":1477},[1631],{"type":35,"tag":126,"props":1632,"children":1633},{},[1634],{"type":41,"value":460},{"type":35,"tag":126,"props":1636,"children":1638},{"class":128,"line":1637},7,[1639],{"type":35,"tag":126,"props":1640,"children":1641},{"emptyLinePlaceholder":286},[1642],{"type":41,"value":289},{"type":35,"tag":126,"props":1644,"children":1646},{"class":128,"line":1645},8,[1647],{"type":35,"tag":126,"props":1648,"children":1649},{},[1650],{"type":41,"value":1555},{"type":35,"tag":126,"props":1652,"children":1654},{"class":128,"line":1653},9,[1655],{"type":35,"tag":126,"props":1656,"children":1657},{},[1658],{"type":41,"value":1659},"class Point(final int x, final int y) {\n",{"type":35,"tag":126,"props":1661,"children":1663},{"class":128,"line":1662},10,[1664],{"type":35,"tag":126,"props":1665,"children":1666},{},[1667],{"type":41,"value":1668},"  this : assert(x >= 0);\n",{"type":35,"tag":126,"props":1670,"children":1672},{"class":128,"line":1671},11,[1673],{"type":35,"tag":126,"props":1674,"children":1675},{},[1676],{"type":41,"value":460},{"type":35,"tag":69,"props":1678,"children":1679},{},[1680,1685,1687],{"type":35,"tag":50,"props":1681,"children":1682},{},[1683],{"type":41,"value":1684},"Leverage Primary Initializer Scope for Calculations",{"type":41,"value":1686},":\nIf a field value is calculated from parameters, declare it inside the body and assign it directly using the parameters:",{"type":35,"tag":115,"props":1688,"children":1690},{"className":259,"code":1689,"language":14,"meta":120,"style":120},"\u002F\u002F Before\nclass Rect {\n  final double width;\n  final double height;\n  final double area;\n  Rect(this.width, this.height) : area = width * height;\n}\n\n\u002F\u002F After\nclass Rect(final double width, final double height) {\n  \u002F\u002F 'width' and 'height' are in scope here\n  final double area = width * height;\n}\n",[1691],{"type":35,"tag":90,"props":1692,"children":1693},{"__ignoreMap":120},[1694,1701,1709,1717,1725,1733,1741,1748,1755,1762,1770,1778,1787],{"type":35,"tag":126,"props":1695,"children":1696},{"class":128,"line":129},[1697],{"type":35,"tag":126,"props":1698,"children":1699},{},[1700],{"type":41,"value":1442},{"type":35,"tag":126,"props":1702,"children":1703},{"class":128,"line":145},[1704],{"type":35,"tag":126,"props":1705,"children":1706},{},[1707],{"type":41,"value":1708},"class Rect {\n",{"type":35,"tag":126,"props":1710,"children":1711},{"class":128,"line":158},[1712],{"type":35,"tag":126,"props":1713,"children":1714},{},[1715],{"type":41,"value":1716},"  final double width;\n",{"type":35,"tag":126,"props":1718,"children":1719},{"class":128,"line":292},[1720],{"type":35,"tag":126,"props":1721,"children":1722},{},[1723],{"type":41,"value":1724},"  final double height;\n",{"type":35,"tag":126,"props":1726,"children":1727},{"class":128,"line":301},[1728],{"type":35,"tag":126,"props":1729,"children":1730},{},[1731],{"type":41,"value":1732},"  final double area;\n",{"type":35,"tag":126,"props":1734,"children":1735},{"class":128,"line":1477},[1736],{"type":35,"tag":126,"props":1737,"children":1738},{},[1739],{"type":41,"value":1740},"  Rect(this.width, this.height) : area = width * height;\n",{"type":35,"tag":126,"props":1742,"children":1743},{"class":128,"line":1637},[1744],{"type":35,"tag":126,"props":1745,"children":1746},{},[1747],{"type":41,"value":460},{"type":35,"tag":126,"props":1749,"children":1750},{"class":128,"line":1645},[1751],{"type":35,"tag":126,"props":1752,"children":1753},{"emptyLinePlaceholder":286},[1754],{"type":41,"value":289},{"type":35,"tag":126,"props":1756,"children":1757},{"class":128,"line":1653},[1758],{"type":35,"tag":126,"props":1759,"children":1760},{},[1761],{"type":41,"value":1555},{"type":35,"tag":126,"props":1763,"children":1764},{"class":128,"line":1662},[1765],{"type":35,"tag":126,"props":1766,"children":1767},{},[1768],{"type":41,"value":1769},"class Rect(final double width, final double height) {\n",{"type":35,"tag":126,"props":1771,"children":1772},{"class":128,"line":1671},[1773],{"type":35,"tag":126,"props":1774,"children":1775},{},[1776],{"type":41,"value":1777},"  \u002F\u002F 'width' and 'height' are in scope here\n",{"type":35,"tag":126,"props":1779,"children":1781},{"class":128,"line":1780},12,[1782],{"type":35,"tag":126,"props":1783,"children":1784},{},[1785],{"type":41,"value":1786},"  final double area = width * height;\n",{"type":35,"tag":126,"props":1788,"children":1790},{"class":128,"line":1789},13,[1791],{"type":35,"tag":126,"props":1792,"children":1793},{},[1794],{"type":41,"value":460},{"type":35,"tag":69,"props":1796,"children":1797},{},[1798,1803,1805],{"type":35,"tag":50,"props":1799,"children":1800},{},[1801],{"type":41,"value":1802},"Convert In-Body Constructors to Redirecting",{"type":41,"value":1804},":\nEnsure all in-body generative constructors redirect to the primary constructor:",{"type":35,"tag":115,"props":1806,"children":1808},{"className":259,"code":1807,"language":14,"meta":120,"style":120},"\u002F\u002F Before\nclass Point {\n  final int x;\n  final int y;\n  Point(this.x, this.y);\n  Point.zero() : x = 0, y = 0;\n}\n\n\u002F\u002F After\nclass Point(final int x, final int y) {\n  new zero() : this(0, 0); \u002F\u002F Redirects to primary\n}\n",[1809],{"type":35,"tag":90,"props":1810,"children":1811},{"__ignoreMap":120},[1812,1819,1826,1833,1840,1848,1856,1863,1870,1877,1884,1892],{"type":35,"tag":126,"props":1813,"children":1814},{"class":128,"line":129},[1815],{"type":35,"tag":126,"props":1816,"children":1817},{},[1818],{"type":41,"value":1442},{"type":35,"tag":126,"props":1820,"children":1821},{"class":128,"line":145},[1822],{"type":35,"tag":126,"props":1823,"children":1824},{},[1825],{"type":41,"value":1603},{"type":35,"tag":126,"props":1827,"children":1828},{"class":128,"line":158},[1829],{"type":35,"tag":126,"props":1830,"children":1831},{},[1832],{"type":41,"value":1611},{"type":35,"tag":126,"props":1834,"children":1835},{"class":128,"line":292},[1836],{"type":35,"tag":126,"props":1837,"children":1838},{},[1839],{"type":41,"value":1619},{"type":35,"tag":126,"props":1841,"children":1842},{"class":128,"line":301},[1843],{"type":35,"tag":126,"props":1844,"children":1845},{},[1846],{"type":41,"value":1847},"  Point(this.x, this.y);\n",{"type":35,"tag":126,"props":1849,"children":1850},{"class":128,"line":1477},[1851],{"type":35,"tag":126,"props":1852,"children":1853},{},[1854],{"type":41,"value":1855},"  Point.zero() : x = 0, y = 0;\n",{"type":35,"tag":126,"props":1857,"children":1858},{"class":128,"line":1637},[1859],{"type":35,"tag":126,"props":1860,"children":1861},{},[1862],{"type":41,"value":460},{"type":35,"tag":126,"props":1864,"children":1865},{"class":128,"line":1645},[1866],{"type":35,"tag":126,"props":1867,"children":1868},{"emptyLinePlaceholder":286},[1869],{"type":41,"value":289},{"type":35,"tag":126,"props":1871,"children":1872},{"class":128,"line":1653},[1873],{"type":35,"tag":126,"props":1874,"children":1875},{},[1876],{"type":41,"value":1555},{"type":35,"tag":126,"props":1878,"children":1879},{"class":128,"line":1662},[1880],{"type":35,"tag":126,"props":1881,"children":1882},{},[1883],{"type":41,"value":1659},{"type":35,"tag":126,"props":1885,"children":1886},{"class":128,"line":1671},[1887],{"type":35,"tag":126,"props":1888,"children":1889},{},[1890],{"type":41,"value":1891},"  new zero() : this(0, 0); \u002F\u002F Redirects to primary\n",{"type":35,"tag":126,"props":1893,"children":1894},{"class":128,"line":1780},[1895],{"type":35,"tag":126,"props":1896,"children":1897},{},[1898],{"type":41,"value":460},{"type":35,"tag":58,"props":1900,"children":1902},{"id":1901},"workflow-52-applying-abbreviated-concise-in-body-constructors",[1903],{"type":41,"value":1904},"Workflow 5.2: Applying Abbreviated (Concise) In-Body Constructors",{"type":35,"tag":44,"props":1906,"children":1907},{},[1908],{"type":41,"value":1909},"When the user prefers to keep the constructor in the class body but wants to reduce verbosity, suggest the abbreviated constructor syntax:",{"type":35,"tag":115,"props":1911,"children":1913},{"className":259,"code":1912,"language":14,"meta":120,"style":120},"\u002F\u002F Before\nclass DatabaseService {\n  final String url;\n  DatabaseService(this.url);\n  DatabaseService.local() : url = 'localhost';\n  factory DatabaseService.create() => DatabaseService('default');\n}\n\n\u002F\u002F After\nclass DatabaseService {\n  final String url;\n  new(this.url); \u002F\u002F Omit class name, use 'new'\n  new local() : url = 'localhost'; \u002F\u002F Use 'new local' for named constructors\n  factory create() => DatabaseService('default'); \u002F\u002F Omit class name from factory\n}\n",[1914],{"type":35,"tag":90,"props":1915,"children":1916},{"__ignoreMap":120},[1917,1924,1932,1940,1948,1956,1964,1971,1978,1985,1992,1999,2007,2015,2024],{"type":35,"tag":126,"props":1918,"children":1919},{"class":128,"line":129},[1920],{"type":35,"tag":126,"props":1921,"children":1922},{},[1923],{"type":41,"value":1442},{"type":35,"tag":126,"props":1925,"children":1926},{"class":128,"line":145},[1927],{"type":35,"tag":126,"props":1928,"children":1929},{},[1930],{"type":41,"value":1931},"class DatabaseService {\n",{"type":35,"tag":126,"props":1933,"children":1934},{"class":128,"line":158},[1935],{"type":35,"tag":126,"props":1936,"children":1937},{},[1938],{"type":41,"value":1939},"  final String url;\n",{"type":35,"tag":126,"props":1941,"children":1942},{"class":128,"line":292},[1943],{"type":35,"tag":126,"props":1944,"children":1945},{},[1946],{"type":41,"value":1947},"  DatabaseService(this.url);\n",{"type":35,"tag":126,"props":1949,"children":1950},{"class":128,"line":301},[1951],{"type":35,"tag":126,"props":1952,"children":1953},{},[1954],{"type":41,"value":1955},"  DatabaseService.local() : url = 'localhost';\n",{"type":35,"tag":126,"props":1957,"children":1958},{"class":128,"line":1477},[1959],{"type":35,"tag":126,"props":1960,"children":1961},{},[1962],{"type":41,"value":1963},"  factory DatabaseService.create() => DatabaseService('default');\n",{"type":35,"tag":126,"props":1965,"children":1966},{"class":128,"line":1637},[1967],{"type":35,"tag":126,"props":1968,"children":1969},{},[1970],{"type":41,"value":460},{"type":35,"tag":126,"props":1972,"children":1973},{"class":128,"line":1645},[1974],{"type":35,"tag":126,"props":1975,"children":1976},{"emptyLinePlaceholder":286},[1977],{"type":41,"value":289},{"type":35,"tag":126,"props":1979,"children":1980},{"class":128,"line":1653},[1981],{"type":35,"tag":126,"props":1982,"children":1983},{},[1984],{"type":41,"value":1555},{"type":35,"tag":126,"props":1986,"children":1987},{"class":128,"line":1662},[1988],{"type":35,"tag":126,"props":1989,"children":1990},{},[1991],{"type":41,"value":1931},{"type":35,"tag":126,"props":1993,"children":1994},{"class":128,"line":1671},[1995],{"type":35,"tag":126,"props":1996,"children":1997},{},[1998],{"type":41,"value":1939},{"type":35,"tag":126,"props":2000,"children":2001},{"class":128,"line":1780},[2002],{"type":35,"tag":126,"props":2003,"children":2004},{},[2005],{"type":41,"value":2006},"  new(this.url); \u002F\u002F Omit class name, use 'new'\n",{"type":35,"tag":126,"props":2008,"children":2009},{"class":128,"line":1789},[2010],{"type":35,"tag":126,"props":2011,"children":2012},{},[2013],{"type":41,"value":2014},"  new local() : url = 'localhost'; \u002F\u002F Use 'new local' for named constructors\n",{"type":35,"tag":126,"props":2016,"children":2018},{"class":128,"line":2017},14,[2019],{"type":35,"tag":126,"props":2020,"children":2021},{},[2022],{"type":41,"value":2023},"  factory create() => DatabaseService('default'); \u002F\u002F Omit class name from factory\n",{"type":35,"tag":126,"props":2025,"children":2027},{"class":128,"line":2026},15,[2028],{"type":35,"tag":126,"props":2029,"children":2030},{},[2031],{"type":41,"value":460},{"type":35,"tag":2033,"props":2034,"children":2035},"style",{},[2036],{"type":41,"value":2037},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2039,"total":2175},[2040,2051,2062,2074,2085,2094,2106,2118,2130,2142,2156,2166],{"slug":2041,"name":2041,"fn":2042,"description":2043,"org":2044,"tags":2045,"stars":16,"repoUrl":17,"updatedAt":2050},"dart-add-unit-test","write unit tests for Dart code","Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2046,2047],{"name":13,"slug":14,"type":15},{"name":2048,"slug":2049,"type":15},"Testing","testing","2026-07-15T05:22:40.104823",{"slug":2052,"name":2052,"fn":2053,"description":2054,"org":2055,"tags":2056,"stars":16,"repoUrl":17,"updatedAt":2061},"dart-build-cli-app","build Dart command line applications","Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2057,2060],{"name":2058,"slug":2059,"type":15},"CLI","cli",{"name":13,"slug":14,"type":15},"2026-07-15T05:22:18.863572",{"slug":2063,"name":2063,"fn":2064,"description":2065,"org":2066,"tags":2067,"stars":16,"repoUrl":17,"updatedAt":2073},"dart-collect-coverage","collect Dart test coverage reports","Collect coverage using the coverage packge and create an LCOV report",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2068,2069,2072],{"name":13,"slug":14,"type":15},{"name":2070,"slug":2071,"type":15},"Reporting","reporting",{"name":2048,"slug":2049,"type":15},"2026-07-15T05:22:21.38636",{"slug":2075,"name":2075,"fn":2076,"description":2077,"org":2078,"tags":2079,"stars":16,"repoUrl":17,"updatedAt":2084},"dart-fix-runtime-errors","debug and fix Dart runtime errors","Uses get_runtime_errors and lsp to fetch an active stack trace, locate the failing line, apply a fix, and verify resolution via hot_reload.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2080,2081],{"name":13,"slug":14,"type":15},{"name":2082,"slug":2083,"type":15},"Debugging","debugging","2026-07-15T05:22:22.622501",{"slug":2086,"name":2086,"fn":2087,"description":2088,"org":2089,"tags":2090,"stars":16,"repoUrl":17,"updatedAt":2093},"dart-generate-test-mocks","generate mock objects for Dart tests","Define and generate mock objects for external dependencies using `package:mockito` and `build_runner`. Use when unit testing classes that depend on complex external services like APIs or databases.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2091,2092],{"name":13,"slug":14,"type":15},{"name":2048,"slug":2049,"type":15},"2026-07-15T05:22:42.607449",{"slug":2095,"name":2095,"fn":2096,"description":2097,"org":2098,"tags":2099,"stars":16,"repoUrl":17,"updatedAt":2105},"dart-migrate-to-checks-package","migrate test matchers to checks package","Replace the usage of `expect` and similar functions from `package:matcher`\nto `package:checks` equivalents.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2100,2101,2104],{"name":13,"slug":14,"type":15},{"name":2102,"slug":2103,"type":15},"Migration","migration",{"name":2048,"slug":2049,"type":15},"2026-07-15T05:22:31.276564",{"slug":2107,"name":2107,"fn":2108,"description":2109,"org":2110,"tags":2111,"stars":16,"repoUrl":17,"updatedAt":2117},"dart-resolve-package-conflicts","resolve Dart package version conflicts","Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2112,2113,2114],{"name":13,"slug":14,"type":15},{"name":2082,"slug":2083,"type":15},{"name":2115,"slug":2116,"type":15},"Engineering","engineering","2026-07-15T05:22:30.059335",{"slug":2119,"name":2119,"fn":2120,"description":2121,"org":2122,"tags":2123,"stars":16,"repoUrl":17,"updatedAt":2129},"dart-run-static-analysis","run static analysis and apply fixes","Execute `dart analyze` to identify warnings and errors, and use `dart fix --apply` to automatically resolve mechanical lint issues. Use during development to ensure code quality and before committing changes.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2124,2127,2128],{"name":2125,"slug":2126,"type":15},"Code Analysis","code-analysis",{"name":13,"slug":14,"type":15},{"name":2082,"slug":2083,"type":15},"2026-07-15T05:22:23.861119",{"slug":2131,"name":2131,"fn":2132,"description":2133,"org":2134,"tags":2135,"stars":16,"repoUrl":17,"updatedAt":2141},"dart-setup-ffi-assets","package C\u002FC++ assets for Dart","Guides agents in compiling and packaging C\u002FC++ source code into dynamic or static libraries (Code Assets) using Dart's Native Assets hook system (via hook\u002Fbuild.dart and hook\u002Flink.dart utilizing package:hooks and package:native_toolchain_c). Use when a user asks to: 'setup native assets', 'compile C\u002FC++ source code', 'bundle dynamic libraries', 'build native C code', 'link native assets', 'implement build.dart or link.dart hooks', or 'integrate C\u002FC++ interop in Dart\u002FFlutter'. Helps agents avoid manual toolchain orchestration and configures secure hash-validated binary downloads or advanced linker tree-shaking with package:record_use mapping.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2136,2137,2140],{"name":13,"slug":14,"type":15},{"name":2138,"slug":2139,"type":15},"Deployment","deployment",{"name":2115,"slug":2116,"type":15},"2026-07-15T05:22:20.138636",{"slug":2143,"name":2143,"fn":2144,"description":2145,"org":2146,"tags":2147,"stars":16,"repoUrl":17,"updatedAt":2155},"dart-skills-lint-setup","configure dart_skills_lint for Dart projects","Use this skill when you need to set up validation for AI agent skills in a Dart project for the first time.\nAdds the linter as a dev_dependency, creates a configuration file, and generates a baseline for legacy repos.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2148,2149,2152],{"name":13,"slug":14,"type":15},{"name":2150,"slug":2151,"type":15},"Plugin Development","plugin-development",{"name":2153,"slug":2154,"type":15},"QA","qa","2026-07-15T05:22:47.488998",{"slug":2157,"name":2157,"fn":2158,"description":2159,"org":2160,"tags":2161,"stars":16,"repoUrl":17,"updatedAt":2165},"dart-skills-lint-validation","validate agent skills with dart_skills_lint","Use this skill when you need to validate AI agent skills with dart_skills_lint — running the linter, interpreting failures, fixing violations, and authoring custom rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2162,2163,2164],{"name":13,"slug":14,"type":15},{"name":2150,"slug":2151,"type":15},{"name":2153,"slug":2154,"type":15},"2026-07-21T05:38:34.451024",{"slug":2167,"name":2167,"fn":2168,"description":2169,"org":2170,"tags":2171,"stars":16,"repoUrl":17,"updatedAt":2174},"dart-use-ffigen","generate FFI bindings with ffigen","Guide agents to use `package:ffigen` to automatically generate FFI bindings instead of writing them manually. Use this skill when a task involves writing new FFI bindings, extending C\u002FObjective-C\u002FSwift integrations, or replacing hand-crafted `dart:ffi` setups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2172,2173],{"name":13,"slug":14,"type":15},{"name":2115,"slug":2116,"type":15},"2026-07-15T05:22:17.592351",27,{"items":2177,"total":2216},[2178,2183,2188,2194,2199,2204,2210],{"slug":2041,"name":2041,"fn":2042,"description":2043,"org":2179,"tags":2180,"stars":16,"repoUrl":17,"updatedAt":2050},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2181,2182],{"name":13,"slug":14,"type":15},{"name":2048,"slug":2049,"type":15},{"slug":2052,"name":2052,"fn":2053,"description":2054,"org":2184,"tags":2185,"stars":16,"repoUrl":17,"updatedAt":2061},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2186,2187],{"name":2058,"slug":2059,"type":15},{"name":13,"slug":14,"type":15},{"slug":2063,"name":2063,"fn":2064,"description":2065,"org":2189,"tags":2190,"stars":16,"repoUrl":17,"updatedAt":2073},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2191,2192,2193],{"name":13,"slug":14,"type":15},{"name":2070,"slug":2071,"type":15},{"name":2048,"slug":2049,"type":15},{"slug":2075,"name":2075,"fn":2076,"description":2077,"org":2195,"tags":2196,"stars":16,"repoUrl":17,"updatedAt":2084},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2197,2198],{"name":13,"slug":14,"type":15},{"name":2082,"slug":2083,"type":15},{"slug":2086,"name":2086,"fn":2087,"description":2088,"org":2200,"tags":2201,"stars":16,"repoUrl":17,"updatedAt":2093},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2202,2203],{"name":13,"slug":14,"type":15},{"name":2048,"slug":2049,"type":15},{"slug":2095,"name":2095,"fn":2096,"description":2097,"org":2205,"tags":2206,"stars":16,"repoUrl":17,"updatedAt":2105},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2207,2208,2209],{"name":13,"slug":14,"type":15},{"name":2102,"slug":2103,"type":15},{"name":2048,"slug":2049,"type":15},{"slug":2107,"name":2107,"fn":2108,"description":2109,"org":2211,"tags":2212,"stars":16,"repoUrl":17,"updatedAt":2117},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2213,2214,2215],{"name":13,"slug":14,"type":15},{"name":2082,"slug":2083,"type":15},{"name":2115,"slug":2116,"type":15},24]