dart-add-unit-test
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains…
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.
$ npx -y skills add flutter/agent-plugins --skill dart-fix-runtime-errors --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/dart-fix-runtime-errorsContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
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
Enforce Dart's sound type system to prevent runtime invalid states.
Eliminate static errors related to null safety by correctly managing variable initialization and nullability.
Distinguish between recoverable exceptions and unrecoverable errors.
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** Execute the Dart analyzer to identify all static errors in the target directory or file.
dart analyze . --fatal-infos
**2. 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 --apply
**3. Resolve remaining errors manually** Review the remaining analyzer output and apply conditional logic based on the error type:
**4. Verify fixes (Feedback Loop)** Run the validator. Review errors. Fix.
dart analyze . dart test
**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);
}**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
}**Input (Fails Static Analysis):**
class Thermometer {
String temperature; // Error: Non-nullable instance field muAgent plugins for Flutter, maintained by the Flutter team. A collection of plugins designed to extend AI agent capabilities for Flutter development.
Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains…
Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.
Collect coverage using the coverage packge and create an LCOV report
Define and generate mock objects for external dependencies using `package:mockito` and `build_runner`. Use when unit testing classes that depend on complex…
Replace the usage of `expect` and similar functions from `package:matcher` to `package:checks` equivalents.
Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.