This package is deprecated and is no longer actively maintained. The repository remains public and available for the community to fork.
Mockingjay provides mock classes for testing Flutter's Navigator 1.0 (imperative) APIs.
The Flutter ecosystem has broadly shifted toward Navigator 2.0 — the declarative navigation API —
and packages like go_router have become the de facto standard
for navigation in modern Flutter applications.
Given this shift, maintaining Mockingjay no longer aligns with the current direction of the Flutter community. Rather than let it languish with infrequent updates, we are making the deprecation official so users can plan accordingly.
The package will remain available on pub.dev and the source code will stay public and available to fork. If there is enough community interest, anyone is welcome to create and maintain a community edition.
You have two paths depending on how your app handles navigation:
If you are building a new app or are willing to update your navigation layer, migrating to Navigator 2.0 is the recommended long-term path.
-
Adopt
go_router(or another Navigator 2.0-compatible package) for your app's routing. See the go_router documentation to get started. -
Update your tests. With
go_router, navigation is driven by aGoRouterinstance. In tests, you can provide a mock router with a test-specific configuration and inject it as aProviderso you can access it throughBuildContext:final router = GoRouter( initialLocation: '/', routes: [ GoRoute(path: '/', builder: (_, __) => const HomeScreen()), GoRoute(path: '/detail', builder: (_, __) => const DetailScreen()), ], ); testWidgets('navigates to detail', (tester) async { await tester.pumpWidget(MaterialApp.router(routerConfig: router)); // Interact and assert normally });
-
Remove the
mockingjaydependency from yourpubspec.yamlonce all usages have been replaced.
Navigator 1.0 is still part of Flutter and is not going away. If your project intentionally uses the imperative API and you rely on Mockingjay, you have two options:
- Fork the repository and maintain your own copy. The source code is fully public under its existing license.
- Use
NavigatorObserverand manual test doubles as a lightweight alternative, which requires no third-party package.
Thank you to everyone who used and contributed to Mockingjay over the years.