dart-migrate-to-checks-package

Migrates Dart test assertions from package:matcher expect syntax to package:checks literate API.

Updated Jul 23, 2025
One-click install
npx skills add https://github.com/derrik-fleming/dotfiles --skill dart-migrate-to-checks-package-derrik-fleming
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dart-migrate-to-checks-package
Source: https://github.com/derrik-fleming/dotfiles/tree/main/private_dot_agents/skills/dart-migrate-to-checks-package
Command: npx skills add https://github.com/derrik-fleming/dotfiles --skill dart-migrate-to-checks-package-derrik-fleming

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dart test suites written with package:matcher use the legacy expect() syntax, and manually converting hundreds of assertions to the modern package:checks API is tedious and error-prone. This Skill automates the migration with concrete syntax mappings, dependency management steps, and validation feedback loops. ## Core Features & Use Cases - Syntax Migration Rules: Converts expect(actual, expected) to check(actual).equals(expected), isA type checks, property extraction with has(), and cascade-based composed assertions. - Async Handling: Migrates Future expectations with completes() and throws(), plus Stream checks using StreamQueue and emitsThrough(). - Validation Workflow: Uses Dart MCP tools (pub, analyze_files, run_tests, dart_fix) in iterative feedback loops until static analysis is clean and all tests pass. - Use Case: You inherit a Flutter project with 50 test files using package:matcher. This Skill adds package:checks as a dev dependency, rewrites every expect() call, and verifies the migration with the analyzer and test runner. ## Quick Start Migrate all test files in this Dart project from package:matcher expect syntax to package:checks and verify with the analyzer and test runner.

Frequently Asked Questions about dart-migrate-to-checks-package

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

FAQPage Schema
How do I migrate Dart tests from matcher to checks package?▼

Add package:checks as a dev dependency with dart pub add dev:checks, import package:checks/checks.dart, then rewrite expect(actual, expected) calls as check(actual).equals(expected). Run the analyzer and tests to validate each converted file.

What is the difference between package:matcher and package:checks?▼

package:matcher uses the expect(actual, matcher) style with composable matcher objects, while package:checks provides a literate API where you call check(actual) and chain methods like equals(), isA(), and startsWith(). The checks package is the modern replacement for test assertions.

How do I convert async expect calls with Futures to package:checks?▼

Await the check call and use completes() for values or throws() for errors. For example, expect(future, completion(equals(10))) becomes await check(future).completes((it) => it.equals(10)).

Should I remove package:matcher from pubspec.yaml after migrating?▼

Remove package:matcher only if it is explicitly listed in your pubspec.yaml. It is often transitively included by package:test, which is fine and does not require any action.

How do I check Stream expectations with package:checks?▼

Wrap the Stream in a StreamQueue for multiple sequential checks, or use .withQueue for single or broadcast checks. Then await assertions like check(queue).emitsThrough((it) => it.equals(expected)).