← ClaudeAtlas

dart-fix-runtime-errorslisted

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.
novahiz/novahiz · ★ 1 · AI & Automation · score 70
Install: claude install-skill novahiz/novahiz
# 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>`). * **Downcasting:** Avoid implicit downcasts from `dynamic`. Use explicit casts (e.g., `as List<Cat>`) when necessary, but ensure the underlying runtime type matches to prevent `TypeError` exceptions. * **Strict Casts:** Enable `strict-casts: true` in `analysis_options.yaml` under `analyzer: 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, and `required` for named paramet