flutter-add-widget-test

flutter-add-widget-test is a skill for Claude Code from flutter/agent-plugins. It costs 48 tokens per session (1,488 once invoked), scanned A, original, BSD-3-Clause.

A guide to Flutter widget tests, which build an individual interface component and check what it displays and how it reacts to actions. A widget is a reusable piece of a Flutter app's interface, such as a button, form, or screen section.

In plain words
What is it for?
Use it to test whether widgets show the right content and respond correctly to taps, scrolling, text entry, and other user actions.
Why use it?
It finds rendering and interaction problems quickly without testing the whole application at once.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dart-flutter plugin — 31 skills shipped together

Good fit Use it to test whether widgets show the right content and respond correctly to taps, scrolling, text entry, and other user actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/flutter/agent-plugins/flutter-add-widget-test
About the project

Flutter Agent Plugins is a collection maintained by the Flutter team that extends coding agents with Flutter-specific skills, rules, MCP configuration, and bundled workflows. Flutter developers use it to help agents perform tasks such as testing and building widget previews. The catalogue entries are components of these agent plugins.

flutter/agent-plugins · 3,065 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add flutter/agent-plugins --skill flutter-add-widget-test
Clone the repo
git clone --depth 1 https://github.com/flutter/agent-plugins

Made for: Claude Code.

Or install dart-flutter, the plugin that ships this one along with the rest of its 31 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for flutter-add-widget-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/flutter/agent-plugins/flutter-add-widget-test/github.svg)](https://agentmods.dev/skills/flutter/agent-plugins/flutter-add-widget-test)
Your own site
<a href="https://agentmods.dev/skills/flutter/agent-plugins/flutter-add-widget-test"><img src="https://agentmods.dev/badge/skills/flutter/agent-plugins/flutter-add-widget-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for flutter-add-widget-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/flutter/agent-plugins/flutter-add-widget-test"><img src="https://agentmods.dev/badge/skills/flutter/agent-plugins/flutter-add-widget-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,488 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 13 Jul 2026
  • Snyk pass 13 Jul 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.01488
Opus 5.5 $0.00019 $0.00595
Sonnet 5.5 $0.00010 $0.00298
Haiku 4.5 $0.00005 $0.00149

Measured 1mo ago against content hash 6c449ebd844e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

flutter-add-widget-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/flutter-add-widget-test/SKILL.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing Flutter Widget Tests

Contents

Setup & Configuration

Ensure the testing environment is properly configured before authoring widget tests.

  1. Add the flutter_test dependency to the dev_dependencies section of pubspec.yaml.
  2. Place all test files in the test/ directory at the root of the project.
  3. Suffix all test file names with _test.dart (e.g., widget_test.dart).

Core Components

Utilize the following flutter_test components to interact with and validate the widget tree:

  • WidgetTester: The primary interface for building and interacting with widgets in the test environment. Provided automatically by the testWidgets() function.
  • Finder: Locates widgets in the test environment (e.g., find.text('Submit'), find.byType(TextField), find.byKey(Key('submit_btn'))).
  • Matcher: Verifies the presence or state of widgets located by a Finder (e.g., findsOneWidget, findsNothing, findsNWidgets(2), matchesGoldenFile).

Workflow: Implementing a Widget Test

Copy the following checklist to track progress when implementing a new widget test.

Task Progress

  • Step 1: Define the test. Use testWidgets('description', (WidgetTester tester) async { ... }).
  • Step 2: Build the widget. Call await tester.pumpWidget(MyWidget()) to render the UI. Wrap the widget in a MaterialApp or Directionality widget if it requires inherited directional or theme data.
  • Step 3: Locate elements. Instantiate Finder objects for the target widgets.
  • Step 4: Verify initial state. Use expect(finder, matcher) to validate the initial render.
  • Step 5: Simulate interactions. Execute gestures or inputs (e.g., await tester.tap(buttonFinder)).
  • Step 6: Rebuild the tree. Call await tester.pump() or await tester.pumpAndSettle() to process state changes.
  • Step 7: Verify updated state. Use expect() to validate the UI after the interaction.
  • Step 8: Run and validate. Execute flutter test test/your_test_file_test.dart.
  • Step 9: Feedback Loop. Review test output -> identify failing matchers -> adjust widget logic or test assertions -> re-run until passing.

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 155 lines · 48 tokens per session scan A 6c449ebd844e

Subscribe to this mod's changes

flutter-add-widget-test is a skill published in the GitHub repository flutter/agent-plugins (3,065 stars, last pushed today), licensed BSD-3-Clause. It adds 48 tokens to every session and 1,488 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

swift-protocol-di-testing

Protocol-based dependency injection for testable Swift code — mock file system, network, and external APIs using focused protocols and Swift Testing.

affaan-m/ECC · 32 tokens

android-do-not-mock

How to write (or fix) Chromium Java unit tests (Robolectric / JUnit) without mocking or spying android.view.View, android.app.Activity, or their subclasses. Use when removing @SuppressWarnings("DoNotMock"), fixing a "DoNotMock" Error Prone error, replacing Mockito.mock(View.class) / @Mock Activity / spy(view), or when…

chromium/chromium · 96 tokens

android-unit-test

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

chromium/chromium · 36 tokens

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (@testing-library/react-native). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React…

callstack/react-native-testing-library · 134 tokens

flutter-testing-skill

Generates Flutter widget tests, integration tests, and golden tests in Dart. Supports local execution and TestMu AI cloud for real device testing. Use when user mentions "Flutter", "widget test", "WidgetTester", "testWidgets", "fluttertest", "integrationtest". Triggers on: "Flutter", "widget test", "Dart test"…

LambdaTest/agent-skills · 89 tokens

mobiai-android-testing

Use when writing or running tests in an Android project — unit tests, UI tests, choosing the right framework and patterns.

ArisGuimera/MobiAI-Core · 30 tokens