mockito

mockito is a skill for Claude Code from evanca/flutter-ai-rules. It costs 32 tokens per session (857 once invoked), scanned A, original, MIT.

A guide for using Mockito, a Dart and Flutter library that creates test doubles such as mocks and fakes. It covers generated mocks, method stubbing, interaction checks, and choosing real objects when they are sufficient.

In plain words
What is it for?
Use it when writing tests that need simulated services, configured return values, call-count or argument checks, generated mock classes, or advice on choosing between real objects, fakes, and mocks.
Why use it?
It helps tests isolate the code under test without mocking data models or testing the mock itself. It also avoids common setup and code-generation mistakes.

Skill for Claude Code

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

Part of the flutter-ai-skills plugin — 36 skills shipped together

Good fit Use it when writing tests that need simulated services, configured return values, call-count or argument checks, generated mock classes, or advice on choosing between real objects, fakes, and mocks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/evanca/flutter-ai-rules/mockito
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 evanca/flutter-ai-rules --skill mockito
Clone the repo
git clone --depth 1 https://github.com/evanca/flutter-ai-rules

Made for: Claude Code.

Or install flutter-ai-skills, the plugin that ships this one along with the rest of its 36 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 mockito

README.md
[![agentmods](https://agentmods.dev/badge/skills/evanca/flutter-ai-rules/mockito/github.svg)](https://agentmods.dev/skills/evanca/flutter-ai-rules/mockito)
Your own site
<a href="https://agentmods.dev/skills/evanca/flutter-ai-rules/mockito"><img src="https://agentmods.dev/badge/skills/evanca/flutter-ai-rules/mockito/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 mockito

Your own site · 80×15
<a href="https://agentmods.dev/skills/evanca/flutter-ai-rules/mockito"><img src="https://agentmods.dev/badge/skills/evanca/flutter-ai-rules/mockito.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 857 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • 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.00032 $0.00857
Opus 5.5 $0.00013 $0.00343
Sonnet 5.5 $0.00006 $0.00171
Haiku 4.5 $0.00003 $0.00086

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

Security

Grade A, and why

mockito scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

when(mock.fetch(any, headers: any)).thenReturn(response);
skills/mockito/SKILL.md · 147 lines

How it starts

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

Mockito Skill

This skill defines how to correctly use the mockito package for mocking in Dart and Flutter tests.


1. Mock vs. Fake vs. Real Object

Use When
Real object Prefer over mocks when practical.
Fake (extends Fake) Lightweight custom implementation; override only the methods you need. Prefer over mocks when you don't need interaction verification.
Mock (extends Mock) Only when you need to verify interactions (call counts, arguments) or stub dynamic responses.
  • Data models should not be mocked if they can be constructed with stubbed data.
  • Only use mocks if your test has verify assertions; otherwise prefer real or fake objects.

2. Generating Mocks

@GenerateMocks([MyClass])
// or for nice mocks (return simple legal values for missing stubs):
@GenerateNiceMocks([MockSpec<MyClass>()])
void main() { ... }
dart run build_runner build
  • Only annotate files under test/ for mock generation by default.
  • Use a build.yaml if you need to generate mocks outside of test/.
  • Never add @override methods or implementations to a class extending Mock.
  • Never stub responses in a mock's constructor or inside the mock class — always stub in your tests.

3. Stubbing

final mock = MockCat();

// Return a value
when(mock.sound()).thenReturn('Meow');

// Throw an error
when(mock.sound()).thenThrow(Exception('No sound'));

// Calculate response at call time
when(mock.sound()).thenAnswer((_) => computedValue);

// Return values in sequence
when(mock.sound()).thenReturnInOrder(['Meow', 'Purr']);
  • Always stub methods/getters before using them if you need specific return values.
  • Missing stub behavior: @GenerateMocks → throws; @GenerateNiceMocks → returns a simple legal value.
  • Use throwOnMissingStub(mock) to throw on any unstubbed call.

4. Verification

verify(mock.sound());                  // called at least once
verifyNever(mock.eat(any));            // never called
verify(mock.sound()).called(2);        // called exactly twice

Read the full file on GitHub · 147 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 · 147 lines · 32 tokens per session scan A 1c50c248c119

Subscribe to this mod's changes

mockito is a skill published in the GitHub repository evanca/flutter-ai-rules (653 stars, last pushed 10d ago), licensed MIT. It adds 32 tokens to every session and 857 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.