flutter-add-widget-test

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

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aashahin/ai-skills --skill flutter-add-widget-test-aashahin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flutter-add-widget-test
Source: https://github.com/aashahin/ai-skills/tree/main/flutter-add-widget-test
Command: npx skills add https://github.com/aashahin/ai-skills --skill flutter-add-widget-test-aashahin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Verifying that Flutter widgets render correctly and respond to user interactions like taps, scrolls, and text input requires structured component-level tests, which are tedious to write correctly without a clear workflow. ## Core Features & Use Cases - Widget Test Workflow: A step-by-step checklist covering test definition, widget building with pumpWidget, element location with Finders, and state verification with Matchers. - Interaction Handling: Conditional guidance for taps, text entry, scrolling to off-screen items, and animations using pump versus pumpAndSettle. - Use Case: You built a TodoList widget and need to confirm that entering text, tapping the add button, and swiping to dismiss items all update the UI as expected. ## Quick Start Write a Flutter widget test for my TodoList widget that verifies adding and dismissing a todo 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 widget test in Flutter?▼

Use the testWidgets function with a WidgetTester callback, call pumpWidget to build your widget, then use Finder objects with expect and Matchers like findsOneWidget to verify rendering. Wrap widgets in MaterialApp if they need theme or directionality data.

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

Use tester.tap with a Finder to simulate taps and tester.enterText to input text into a TextField. After the interaction, call tester.pump to rebuild the widget tree, then assert the updated state with expect.

What is the difference between pump and pumpAndSettle in Flutter tests?▼

pump triggers a single frame rebuild, suitable for standard state changes like button taps. pumpAndSettle repeatedly pumps frames until no more are scheduled, which is required for animations, transitions, and asynchronous UI updates.

How do I test items in a long Flutter ListView?▼

Use tester.scrollUntilVisible with the target item Finder, a scroll delta, and the scrollable Finder to bring off-screen items into view before interacting with them. This ensures the widget is rendered before assertions run.

Why does my Flutter widget test fail to find a widget?▼

The widget may not be built yet, may require a MaterialApp or Directionality ancestor, or may be off-screen in a scrollable list. Verify you called pumpWidget, wrapped the widget correctly, and used scrollUntilVisible for lazy lists.