Search categories, packages and repositories

Package detailsv1.3.3

fake_async

Fake asynchronous events such as timers and microtasks for deterministic testing.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
10.3M
Likes
123
Pub points
150

Install package

flutter pub add fake_async

Package Overview

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

fake_async is a Dart package designed for deterministic testing of asynchronous code. It allows developers to simulate timers, microtasks, and other async events in a controlled environment, ensuring test results are predictable and repeatable. By faking asynchronous behavior, it eliminates reliance on real-time delays, making tests faster and more reliable. Ideal for unit and integration tests that involve async operations like futures, streams, or scheduled tasks.

Use cases

  • Testing async code without real delays
  • Simulating timers and microtasks
  • Writing deterministic unit tests
  • Validating stream and future logic
  • Improving test performance

Key features

  • Controls timing of async operations
  • Supports microtask and timer fakes
  • Enables precise test execution
  • Integrates with the test package
  • Provides clean API for async mocking

Suitable for

  • Dart developers writing unit tests
  • Teams prioritizing test reliability
  • Projects with complex async workflows
  • Test-driven development practices
  • CI/CD pipelines requiring fast tests

Considerations

  • Not suitable for end-to-end testing
  • Requires understanding of event loops
  • Limited to test environments
  • Does not replace real async behavior in production
  • Needs proper setup in test files

Original README

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

Dart CI OpenSSF Scorecard

What's here?

Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api and package:test_core are implementation details and generally not user-facing.

package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher and features a literate API.

Packages

Package Description Issues Version
checks A framework for checking values against expectations and building custom expectations. issues pub package
fake_async Fake asynchronous events such as timers and microtasks for deterministic testing. issues pub package
matcher Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. issues pub package
test A full featured library for writing and running Dart tests across platforms. issues pub package
test_api The user facing API for structuring Dart tests and checking expectations. pub package
test_core A basic library for writing tests and running them on the VM. pub package
test_descriptor An API for defining and verifying files and directory structures. issues pub package
test_process Test processes: starting; validating stdout and stderr; checking exit code. issues pub package

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package