Search categories, packages and repositories

Package detailsv1.0.5

mocktail

A Dart mock library which simplifies mocking with null safety support and no manual mocks or code generation.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
3.9M
Likes
1.3K
Pub points
160

Install package

flutter pub add mocktail

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Mocktail is a Dart mocking library designed to simplify unit testing with null safety support. It eliminates the need for manual mock creation or code generation, allowing developers to create mocks dynamically at runtime. With intuitive syntax and seamless integration into test suites, Mocktail enhances test readability and maintainability. It supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform Flutter applications. The library is maintained by felangel.dev and is widely adopted in the Flutter community for its ease of use and reliability.

Use cases

  • Unit testing with dependency injection
  • Mocking services and repositories
  • Testing business logic without external dependencies
  • Simulating API responses in tests
  • Validating method calls and arguments
  • Isolating components during testing

Key features

  • Null safety compliant
  • No code generation required
  • Dynamic mock creation
  • Intuitive API for mocking and verifying
  • Supports stubbing and verification
  • Cross-platform compatibility

Suitable for

  • Flutter developers writing unit tests
  • Teams prioritizing test simplicity
  • Projects requiring minimal boilerplate
  • Developers avoiding build steps for mocks
  • Test-driven development workflows
  • Applications with complex dependency graphs

Considerations

  • Not suitable for integration or end-to-end testing
  • Requires understanding of mocking concepts
  • May increase test execution time with many mocks
  • Limited to mocking classes and interfaces
  • Does not support mocking top-level functions or variables

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

🍹 mocktail

ci coverage License: MIT

This repository contains mocking libraries for Dart inspired by mockito.


package:mocktail

Pub

A Dart mocking library which simplifies mocking with null safety support and no manual mocks or code generation.


package:mocktail_image_network

Pub

A Dart package which allows you to mock Image.network in your widget tests with confidence using package:mocktail

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package

Rankings