# Flutter add widget test

> Flutter add widget test is an open-source agent skill for developer tools. Guides the agent to write Flutter widget tests with WidgetTester for taps, scrolling. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/flutter/agent-plugins/tree/main/skills/flutter-add-widget-test
- **Repository:** https://github.com/flutter/agent-plugins
- **GitHub stars:** 3,223
- **License:** BSD-3-Clause
- **Skill name:** flutter-add-widget-test
- **Collection:** https://github.com/flutter/agent-plugins
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-30

## About

This skill walks an agent through writing component-level Flutter tests with flutter_test. It covers the project setup (adding the test dependency, placing files under test/ with the _test.dart suffix), the core finder and matcher types, and a step-by-step checklist from building the widget to verifying the updated UI.

The skill also explains which pump method fits each situation: a single pump after a plain tap, pumpAndSettle for animations and async updates, and scrollUntilVisible for long lists. It includes a complete example that adds and dismisses items in a todo list, showing how the pieces fit together in one test.

The agent is expected to run the tests with the flutter test command in a Flutter project. The skill itself ships only its instructions file and no scripts.

## When your agent uses it

> Implement a component-level test using `WidgetTester` to verify UI rendering and user interactions (tapping, scrolling, entering text). Use when validating that a specific widget displays correct data and responds to events as expected.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/flutter/agent-plugins/tree/HEAD/skills/flutter-add-widget-test)
- [License: BSD-3-Clause](https://github.com/flutter/agent-plugins/tree/HEAD/skills/flutter-add-widget-test)

## Features

- **Test setup guidance:** Explains the dependency, folder layout and file naming needed before writing widget tests.
- **Finder and matcher reference:** Summarises the common finders and matchers used to locate and check widgets.
- **Step-by-step test checklist:** Gives an ordered workflow from defining a testWidgets case to re-running it until it passes.
- **Interaction pumping rules:** Maps tapping, dragging, text entry and scrolling to the correct pump or settle calls.
- **Worked todo list example:** Provides a full widget and test pair covering adding and dismissing items.

## Good for

- Write a widget test that checks a login form shows the right error text
- Test that tapping a button updates a counter label on screen
- Verify a list screen scrolls to and displays a specific item
- Add a test that enters text into a search field and checks the results

## Install

### Claude Code

This skill ships in the `dart-flutter` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add flutter/agent-plugins
/plugin install dart-flutter@dart-flutter
```

Or copy only this skill to `~/.claude/skills/flutter-add-widget-test`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/flutter-add-widget-test &&
cp -R "$tmp/skills/flutter-add-widget-test" ~/.claude/skills/flutter-add-widget-test &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/flutter-add-widget-test` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/flutter-add-widget-test` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/flutter-add-widget-test &&
cp -R "$tmp/skills/flutter-add-widget-test" ~/.agents/skills/flutter-add-widget-test &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/flutter-add-widget-test` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/flutter-add-widget-test` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/flutter-add-widget-test &&
cp -R "$tmp/skills/flutter-add-widget-test" ~/.cursor/skills/flutter-add-widget-test &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/flutter-add-widget-test` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/flutter/agent-plugins.git --path skills/flutter-add-widget-test
```

Or copy the folder to `~/.gemini/skills/flutter-add-widget-test` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/flutter-add-widget-test`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/flutter-add-widget-test &&
cp -R "$tmp/skills/flutter-add-widget-test" ~/.copilot/skills/flutter-add-widget-test &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/flutter-add-widget-test` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/flutter/agent-plugins.git
```

Then copy `agent-plugins/skills/flutter-add-widget-test` into your agent's skills folder as `flutter-add-widget-test`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need from my project?

It expects a Flutter project with the flutter_test package listed under dev_dependencies in pubspec.yaml, with test files placed in the test/ directory.

### Does Flutter add widget test change my app code?

Its instructions focus on writing test files. It does not describe modifying the widget beyond the feedback loop of adjusting logic when a test fails.

### How does the agent run the tests?

The checklist tells the agent to run flutter test followed by the path to the test file.

### How do I install Flutter add widget test in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/flutter-add-widget-test to use it in all your projects, or to .claude/skills/flutter-add-widget-test in one project. Or install the dart-flutter plugin, which includes it: /plugin marketplace add flutter/agent-plugins, then /plugin install dart-flutter@dart-flutter.

### Does Flutter add widget test run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Flutter add widget test?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Flutter add widget test?

The closest alternatives to Flutter add widget test are Flutter add integration test, Flutter testing skill, Dart add unit test, Dart generate test mocks and Dart flutter patterns.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Flutter add integration test](https://ai-powered.com/skills/flutter-add-integration-test): Flutter add integration test is an open-source agent skill for developer tools.
- [Flutter testing skill](https://ai-powered.com/skills/flutter-testing-skill): Flutter testing skill is an open-source agent skill for developer tools.
- [Dart add unit test](https://ai-powered.com/skills/dart-add-unit-test): Dart add unit test is an open-source agent skill for developer tools.
- [Dart generate test mocks](https://ai-powered.com/skills/dart-generate-test-mocks): Dart generate test mocks is an open-source agent skill for developer tools.
- [Dart flutter patterns](https://ai-powered.com/skills/dart-flutter-patterns): Dart flutter patterns is an open-source agent skill for developer tools.
- [Xcuitest skill](https://ai-powered.com/skills/xcuitest-skill): Xcuitest skill is an open-source agent skill for developer tools.
- [Cpp testing](https://ai-powered.com/skills/cpp-testing): Cpp testing is an open-source agent skill for developer tools.
- [TDD](https://ai-powered.com/skills/tdd): TDD is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/flutter-add-widget-test
