mockito

Community

Mock confidently for Flutter/Dart tests.

Authorevanca
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Managing mocks and stubs in Flutter/Dart tests manually is error-prone and repetitive. Mockito provides a structured way to generate mocks, verify interactions, and capture arguments, reducing boilerplate and increasing test reliability.

Core Features & Use Cases

  • Mock generation: Use @GenerateMocks to create mock classes for your Dart interfaces or concrete classes.
  • Stubbing and verification: Define return values and verify interactions to ensure correct method usage.
  • Argument capture and matchers: Capture call arguments and use matchers to assert expectations across multiple calls.
  • Test utilities: Use reset and clearInteractions to manage mock state between tests; mock function types and async support for Flutter tests.
  • Advice on real vs fake vs mock: Prefer real or fake implementations when possible; reserve mocks for interaction verification and behavior stubbing.

Quick Start

Annotate your test class with @GenerateMocks([YourClass, AnotherClass]) and run dart run build_runner build to generate the mock classes.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: mockito
Download link: https://github.com/evanca/flutter-ai-rules/archive/main.zip#mockito

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.