dart-fix-runtime-errors

Diagnoses and fixes Dart static analysis errors using analyzer output and automated fixes.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/arslan9024/White-Caves --skill dart-fix-runtime-errors-arslan9024
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dart-fix-runtime-errors
Source: https://github.com/arslan9024/White-Caves/tree/main/.agents/skills/dart-fix-runtime-errors
Command: npx skills add https://github.com/arslan9024/White-Caves --skill dart-fix-runtime-errors-arslan9024

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dart projects accumulate static analysis errors around null safety, type mismatches, and invalid method overrides that block compilation and testing. This Skill provides a structured workflow to identify, fix, and verify these errors systematically. ## Core Features & Use Cases - Static Analysis Workflow: Runs dart analyze, applies dart fix for automated corrections, then resolves remaining errors manually with conditional guidance per error type. - Type System Guidance: Enforces Dart's sound type system with rules for generics, downcasting, covariant overrides, and strict-casts configuration. - Null Safety Resolution: Provides concrete patterns for nullable types, late initialization, and null assertions to eliminate null safety errors. - Use Case: After upgrading a Flutter app's dependencies, dart analyze reports 40 errors. Use this Skill to apply automated fixes, then resolve remaining null safety and override errors, and verify with dart analyze and dart test. ## Quick Start Run dart analyze on my project and help me fix all the reported static analysis errors step by step.

Frequently Asked Questions about dart-fix-runtime-errors

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Dart static analysis errors automatically?▼

Run dart fix --dry-run to preview automated corrections, then dart fix --apply to apply them. Remaining errors that automated fixes cannot handle must be resolved manually based on their error type, such as null safety or type mismatch issues.

How to fix null safety errors in Dart?▼

Determine whether the variable can logically be null. If yes, use optional chaining (?.) or a fallback (??). If initialization is guaranteed elsewhere but not provable by the compiler, mark the declaration with the late keyword.

Why does Dart reject assigning List<dynamic> to List<int>?▼

Dart's sound type system prevents implicit downcasts from dynamic. Fix it by adding explicit generic type annotations at instantiation, such as <int>[] instead of [], or use an explicit cast after verifying the runtime type.

Should I catch Error objects in Dart exception handling?▼

No. Catch Exception subtypes for recoverable failures only. Error subtypes like TypeError and ArgumentError indicate programming bugs that must be fixed, not caught. Enable the avoid_catching_errors linter rule to enforce this.

When should I use the covariant keyword in Dart?▼

Use covariant when a subclass method intentionally tightens a parameter type compared to the overridden superclass method. Without it, tightening parameter types violates contravariance rules and fails static analysis.