Use runtime traces and language-server context to locate, fix, and verify errors.
---
name: dart-fix-runtime-errors
description: 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.
metadata:
model: models/gemini-3.1-pro-preview
last_modified: Fri, 24 Apr 2026 15:13:22 GMT
---
# Resolving Dart Static Analysis Errors
## Contents
- [Core Concepts & Guidelines](#core-concepts--guidelines)
- [Type System & Soundness](#type-system--soundness)
- [Null Safety](#null-safety)
- [Error Handling](#error-handling)
- [Workflows](#workflows)
- [Workflow: Static Analysis Resolution](#workflow-static-analysis-resolution)
- [Examples](#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 `covariant` keyword.
* **Generics & Collections:** Add explicit type annotations to generic classes (e.g., `List<T>`, `Map<K, V>`). Never assign a `List<dynamic>` to a typed list (e.g., `List<Cat>`).… install to load the full skill