flutter-add-widget-test

Implements Flutter widget tests using WidgetTester to verify UI rendering and user interactions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing component-level tests for Flutter widgets requires knowing the correct WidgetTester APIs, pump semantics, and interaction patterns, and mistakes lead to flaky or incomplete test coverage. ## Core Features & Use Cases - Structured Test Workflow: Provides a nine-step checklist covering test definition, widget building, finding elements, simulating interactions, and verifying state. - Interaction Guidance: Supplies conditional logic for taps, text entry, scrolling, drag gestures, and animation handling with pump versus pumpAndSettle. - Use Case: When adding a todo list feature, use this Skill to generate a complete widget test that enters text, taps the add button, verifies the item renders, then dismisses it with a swipe gesture. ## Quick Start Write a Flutter widget test for my TodoList widget that verifies adding and dismissing an item.

Frequently Asked Questions about flutter-add-widget-test

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

FAQPage Schema
How do I write a Flutter widget test with WidgetTester?

Use testWidgets with a WidgetTester callback, call pumpWidget to render the widget, locate elements with Finder objects like find.text or find.byType, then assert with expect and matchers such as findsOneWidget. Wrap widgets in MaterialApp when they need theme or directionality.

How to test button taps and text input in Flutter tests?

Call await tester.tap(finder) to simulate taps and await tester.enterText(finder, 'text') for text fields. After the interaction, call await tester.pump() to rebuild the tree, then verify the updated state with expect.

When should I use pump versus pumpAndSettle in Flutter tests?

Use pump() to trigger a single frame rebuild after standard state changes like button taps. Use pumpAndSettle() when testing animations, transitions, or asynchronous updates, since it repeatedly pumps frames until no more are scheduled.

Why does my Flutter widget test fail to find a widget in a long list?

Items in lazy lists are not rendered until visible. Call await tester.scrollUntilVisible(itemFinder, 500.0, scrollable: listFinder) to scroll the target into view before interacting with or asserting on it.

Where do Flutter widget test files go and how are they named?

Place test files in the test/ directory at the project root and suffix filenames with _test.dart, such as widget_test.dart. Add flutter_test to dev_dependencies in pubspec.yaml, then run tests with flutter test.