dart-fix-runtime-errors

Diagnose and fix Dart static analysis errors using analyzer output and automated fixes.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-fix-runtime-errors-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dart-fix-runtime-errors
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/dart-fix-runtime-errors
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-fix-runtime-errors-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dart projects often 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 and dart fix to detect and automatically resolve standard linting and analysis issues. - Guided Manual Fixes: Provides conditional decision logic for null safety errors, type mismatches, and invalid overrides, including correct use of late, covariant, and explicit generic type annotations. - Verification Feedback Loop: Re-runs the analyzer and test suite to confirm fixes, with guidance for diagnosing runtime TypeError failures caused by bad casts or uninitialized late variables. - Use Case: After upgrading a Flutter app's Dart SDK, dozens of null safety errors appear. Use this Skill to triage each error type, apply the correct fix pattern, and verify the project passes dart analyze and dart test. ## Quick Start Run dart analyze on my project and help me fix all the reported null safety and type errors.

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 null safety errors?

Dart null safety errors are fixed by first checking whether the variable can logically be null. If yes, use optional chaining (?.) or a fallback (??); if initialization is guaranteed elsewhere, mark the declaration with the late keyword to defer the check to runtime.

How to fix List<dynamic> can't be assigned to List<int> in Dart?

This type mismatch occurs when a collection literal is inferred as List<dynamic>. Fix it by adding an explicit generic type annotation at instantiation, such as <int>[] instead of [], so the list matches the expected parameter type.

What does dart fix --apply do?

dart fix --apply automatically resolves standard linting and analysis issues in a Dart project. Run dart fix --dry-run first to preview the proposed changes before applying them to your source files.

Why does my Dart override method cause a parameter type error?

Dart requires overridden method parameters to be contravariant, meaning you cannot tighten a parameter type in a subclass. Either widen the parameter to match the superclass or add the covariant keyword if the narrower type is intentional.

Should I catch Error or Exception in Dart?

Catch Exception subtypes for recoverable failures, but never catch Error or its subtypes like TypeError, since they indicate programming bugs that must be fixed. Enable the avoid_catching_errors linter rule to enforce this practice.