flutter-testing

flutter-testing is a skill for Claude Code, Codex from smicolon/ai-kit. It costs 33 tokens per session (653 once invoked), scanned A, original, MIT.

A guide to testing Flutter apps at several levels: individual pieces of code, widgets, and complete app flows. Widget tests render interface components without requiring a physical device or emulator.

In plain words
What is it for?
Use it to write unit tests, widget tests, and integration tests with Flutter's testing tools and mocking libraries.
Why use it?
It helps catch broken logic and interface interactions before release. Tests also make changes safer by checking that existing behavior still works.

Skill for Claude CodeCodex

Part of the flutter plugin — 9 skills shipped together

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.

agentmods
npx agentmods add skills/smicolon/ai-kit/flutter-testing
Any agent
npx skills add smicolon/ai-kit --skill flutter-testing
Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

Made for: Claude Code, Codex.

Or install flutter, the plugin that ships this one along with the rest of its 9 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-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/smicolon/ai-kit/flutter-testing.svg)](https://agentmods.dev/skills/smicolon/ai-kit/flutter-testing)
Your own site
<a href="https://agentmods.dev/skills/smicolon/ai-kit/flutter-testing"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/flutter-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 653 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00033 $0.00653
Opus 5 $0.00016 $0.00327
Sonnet 5 $0.00007 $0.00131
Haiku 4.5 $0.00003 $0.00065

Measured today against content hash b6098c873f99, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flutter-testing 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 today.

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.

packs/flutter/skills/flutter-testing/SKILL.md · 98 lines

How it starts

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

Flutter Testing Best Practices

Comprehensive testing strategies for Flutter apps across unit, widget, and integration levels.

1. Widget Testing (flutter_test)

Use testWidgets to render UI components in an isolated test environment without a physical device or emulator.

import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:myapp/ui/counter_widget.dart';

void main() {
  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
    // 1. Pump the widget inside a MaterialApp
    await tester.pumpWidget(
      const MaterialApp(home: Scaffold(body: CounterWidget())),
    );

    // 2. Verify initial state
    expect(find.text('0'), findsOneWidget);
    expect(find.text('1'), findsNothing);

    // 3. Perform tap interaction
    await tester.tap(find.byIcon(Icons.add));
    await tester.pump(); // Trigger frame redraw

    // 4. Verify updated state
    expect(find.text('0'), findsNothing);
    expect(find.text('1'), findsOneWidget);
  });
}

Key Tester Methods

  • tester.pumpWidget(widget): Renders the given widget tree.
  • tester.pump(): Re-renders the frame (synchronous setState).
  • tester.pumpAndSettle(): Repeatedly pumps until there are no more scheduled frames or animations.
  • find.byKey(Key('myKey')): Most stable selector for testing.
  • find.byType(ElevatedButton): Selects by widget type.

2. Unit Testing Business Logic & State

Test ViewModels, Repositories, or Bloc without UI:

import 'package:test/test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:myapp/data/repositories/auth_repository.dart';
import 'package:myapp/ui/auth_viewmodel.dart';

class MockAuthRepository extends Mock implements AuthRepository {}

void main() {
  late MockAuthRepository mockRepo;
  late AuthViewModel viewModel;

  setUp(() {
    mockRepo = MockAuthRepository();
    viewModel = AuthViewModel(repository: mockRepo);
  });

  test('login success updates state to authenticated', () async {
    when(() => mockRepo.login('[email protected]', 'secret'))
        .thenAnswer((_) async => const User(id: '123', email: '[email protected]'));

    await viewModel.login('[email protected]', 'secret');

    expect(viewModel.isAuthenticated, isTrue);
    expect(viewModel.currentUser?.id, equals('123'));
  });
}

Read the full file on GitHub · 98 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. today First seen · 98 lines · 33 tokens per session scan A b6098c873f99

Subscribe to this mod's changes

flutter-testing is a skill published in the GitHub repository smicolon/ai-kit (6 stars, last pushed yesterday), licensed MIT. It adds 33 tokens to every session and 653 once invoked, about $0.0002 per session on Opus 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-09-04.