dart-fix-runtime-errors
Skill4 starsChanged 4 months agoMITView on GitHub
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.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- dart-lang/skillsword for word, first seen Oct 16, 2026
- zhouycheng/skillsword for word, first seen Oct 13, 2026
- enrique-lozano/Monekinword for word, first seen Oct 9, 2026
- flutter/skillsword for word, first seen Oct 8, 2026
- RodotDev/arb_aiword for word, first seen May 30, 2026
Used with
Projects with it also use dart-use-doc-examples and dart-write-documentation.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
flutterSkilldart-use-doc-examples
How to inject external code examples into Dartdoc using the {@example} directive, and how to filter those files using #hide, #region, and #endregion tags.
Also in 3 projects that use this
flutterSkilldart-write-documentation
Rules and formatting guidelines for writing Dart /// API documentation and doc comments. Use when documenting Dart code, writing doc comments for any Dart declaration (libraries, classes, methods, variables, etc.), or when instructed to follow the Effective Dart documentation guidelines.
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 5
- flutter/skills★ 3.2k100% same
- dart-lang/skills★ 548100% same
- enrique-lozano/Monekin★ 268100% same
- RodotDev/arb_ai★ 1100% same
- zhouycheng/skills★ 1100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- engine/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- engine/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- brandkitSkill
- code-reviewSkill
- dart-add-unit-testSkill
- dart-build-cli-appSkill
- dart-collect-coverageSkill
- dart-generate-test-mocksSkill
- dart-migrate-to-checks-packageSkill
- dart-resolve-package-conflictsSkill
- dart-run-static-analysisSkill
- dart-setup-ffi-assetsSkill
- dart-use-ffigenSkill
- dart-use-pattern-matchingSkill
- dart-use-primary-constructorsSkill
- design-taste-frontendSkill
- flutter-add-integration-testSkill
- flutter-add-widget-previewSkill
- flutter-add-widget-testSkill
- flutter-apply-architecture-best-practicesSkill
- flutter-build-responsive-layoutSkill
- flutter-fix-layout-issuesSkill
- flutter-implement-json-serializationSkill
- flutter-setup-declarative-routingSkill
- flutter-setup-localizationSkill
- flutter-use-http-packageSkill
- frontend-code-reviewSkill
- full-output-enforcementSkill
- github-releaseSkill
- grill-with-docsSkill
- high-end-visual-designSkill
- imagegen-frontend-webSkill
- image-to-codeSkill
- improve-codebase-architectureSkill
- industrial-brutalist-uiSkill
- minimalist-uiSkill
- redesign-existing-projectsSkill
- source-command-frontend-code-review-skillSkill
- source-command-impeccable-skillSkill
- stitch-design-tasteSkill
- tddSkill
- to-prdSkill
- frontend-code-reviewSkill
- impeccableSkill
- dart-add-unit-testSkill
- dart-build-cli-appSkill
- dart-collect-coverageSkill
- dart-fix-runtime-errorsSkill
- dart-generate-test-mocksSkill
- dart-migrate-to-checks-packageSkill
- dart-resolve-package-conflictsSkill
- dart-run-static-analysisSkill
- dart-setup-ffi-assetsSkill
- dart-use-ffigenSkill
- dart-use-pattern-matchingSkill
- dart-use-primary-constructorsSkill
- flutter-add-integration-testSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Generics & Collections: Add explicit type annotations to generic classes (e.g., List<T>, Map<K, V>).
- Very specific: line 26
Downcasting: Avoid implicit downcasts from dynamic.
- Very specific: line 33
Late Initialization: Use the late keyword for non-nullable variables guaranteed to be initialized before use.
- Very specific: line 34
Wildcards: Use the _ wildcard variable (Dart 3.7+) for non-binding local variables or parameters to avoid unused variable warnings.
- Very specific: line 40
Errors: Never explicitly catch Error or its subtypes (e.g., TypeError, ArgumentError).
- Very specific: line 41
Rethrowing: Use rethrow inside a catch block to propagate an exception while preserving its original stack trace.
- Distinctive: line 47
Use this sequential workflow to identify, fix, and verify static analysis errors in a Dart project.
- Very specific: line 62
Use the dart fix tool to automatically resolve standard linting and analysis issues.
- Distinctive: line 74
Verify if the variable can logically be null.
- Very specific: line 75
If yes, use optional chaining (?.) or provide a fallback (??).
- Very specific: line 76
If no, and initialization is guaranteed elsewhere, mark the declaration with late.
- Very specific: line 79
Add explicit generic type annotations to the instantiation (e.g., <int>[] instead of []).
- Very specific: line 82
Add the covariant keyword to the parameter if tightening the type is intentionally required by the domain logic.
- Distinctive: line 85
Run the validator. Review errors.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Resolving Dart Static Analysis Errors
Contents
- Core Concepts & Guidelines
- Type System & Soundness
- Null Safety
- Error Handling
- Workflows
- Workflow: Static Analysis Resolution
- Examples
Core Concepts & Guidelines
Type System & Soundness
Enforce Dart's sound type system to prevent runtime invalid states.
- Method Overrides: Maintain sound return types (covariant) and parameter types (contravariant). Never tighten a parameter type in a subclass unless explicitly marked with the
covariantkeyword. - Generics & Collections: Add explicit type annotations to generic classes (e.g.,
List<T>,Map<K, V>). Never assign aList<dynamic>to a typed list (e.g.,List<Cat>). - Downcasting: Avoid implicit downcasts from
dynamic. Use explicit casts (e.g.,as List<Cat>) when necessary, but ensure the underlying runtime type matches to preventTypeErrorexceptions. - Strict Casts: Enable
strict-casts: trueinanalysis_options.yamlunderanalyzer: language:to force explicit casting and catch implicit downcast errors at compile time.
Null Safety
Eliminate static errors related to null safety by correctly managing variable initialization and nullability.
- Modifiers: Apply
?for nullable types,!for null assertions, andrequiredfor named parameters that cannot be null. - Late Initialization: Use the
latekeyword for non-nullable variables guaranteed to be initialized before use. Apply this specifically to top-level or instance variables where Dart's control flow analysis cannot definitively prove initialization. - Wildcards: Use the
_wildcard variable (Dart 3.7+) for non-binding local variables or parameters to avoid unused variable warnings.
Error Handling
Distinguish between recoverable exceptions and unrecoverable errors.
- Catching: Catch
Exceptionsubtypes for recoverable failures. - Errors: Never explicitly catch
Erroror its subtypes (e.g.,TypeError,ArgumentError). Errors indicate programming bugs that must be fixed, not caught. Enforce this by enabling theavoid_catching_errorslinter rule. - Rethrowing: Use
rethrowinside acatchblock to propagate an exception while preserving its original stack trace.
Workflows
Workflow: Static Analysis Resolution
Use this sequential workflow to identify, fix, and verify static analysis errors in a Dart project. Copy the checklist to track your progress.
Task Progress:
- 1. Run static analyzer.
- 2. Apply automated fixes.
- 3. Resolve remaining errors manually.
- 4. Verify fixes (Feedback Loop).
1. Run static analyzer Execute the Dart analyzer to identify all static errors in the target directory or file.
dart analyze . --fatal-infos2. Apply automated fixes
Use the dart fix tool to automatically resolve standard linting and analysis issues.
# Preview changes
dart fix --dry-run
# Apply changes
dart fix --apply3. Resolve remaining errors manually Review the remaining analyzer output and apply conditional logic based on the error type:
- If the error is a Null Safety issue (e.g., "Property cannot be accessed on a nullable receiver"):
- Verify if the variable can logically be null.
- If yes, use optional chaining (
?.) or provide a fallback (??). - If no, and initialization is guaranteed elsewhere, mark the declaration with
late.
- If the error is a Type Mismatch (e.g., "The argument type 'List
<dynamic>' can't be assigned..."):- Trace the variable's initialization.
- Add explicit generic type annotations to the instantiation (e.g.,
<int>[]instead of[]).
- If the error is an Invalid Override (e.g., "The parameter type doesn't match the overridden method"):
- Widen the parameter type to match the superclass, OR
- Add the
covariantkeyword to the parameter if tightening the type is intentionally required by the domain logic.
4. Verify fixes (Feedback Loop) Run the validator. Review errors. Fix.
dart analyze .
dart test- If
dart analyzereports errors: Return to Step 3. - If
dart testfails with aTypeError: You have introduced an invalid explicit cast (as T) or accessed an uninitializedlatevariable. Locate the runtime failure and correct the type hierarchy or initialization order.
Examples
Example: Fixing Dynamic List Assignments
Input (Fails Static Analysis):
void printInts(List<int> a) => print(a);
void main() {
final list = []; // Inferred as List<dynamic>
list.add(1);
list.add(2);
printInts(list); // Error: List<dynamic> can't be assigned to List<int>
}Output (Passes Static Analysis):
void printInts(List<int> a) => print(a);
void main() {
final list = <int>[]; // Explicitly typed
list.add(1);
list.add(2);
printInts(list);
}Example: Fixing Method Overrides (Contravariance)
Input (Fails Static Analysis):
class Animal {
void chase(Animal a) {}
}
class Cat extends Animal {
@override
void chase(Mouse a) {} // Error: Tightening parameter type
}Output (Passes Static Analysis):
class Animal {
void chase(Animal a) {}
}
class Cat extends Animal {
@override
void chase(covariant Mouse a) {} // Explicitly marked covariant
}Example: Fixing Null Safety with late
Input (Fails Static Analysis):
class Thermometer {
String temperature; // Error: Non-nullable instance field must be initialized
void read() {
temperature = '20C';
}
}Output (Passes Static Analysis):
class Thermometer {
late String temperature; // Defers initialization check to runtime
void read() {
temperature = '20C';
}
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

