FLUTTER ECOSYSTEM

mocktail

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

Latest version
1.0.5
30-day downloads
2.4M
Likes
1.2K
Pub points
160

Package Overview

Selection guidance generated from public package information. For reference only.

Overview

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
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add mocktail

Categories

Source repository

Related projects

Rankings