Comments (7)
I was able to run the example by explicitly adding types. That means I changed the source code from:
onPressed: () => Navigator.of(context).push(MySettingsPage.route()),
to:
onPressed: () => Navigator.of(context).push<void>(MySettingsPage.route()),
static Route route() {
return MaterialPageRoute(
builder: (_) => const MySettingsPage(),
settings: const RouteSettings(name: '/settings'),
);
}
to:
static Route<void> route() {
return MaterialPageRoute<void>(
builder: (_) => const MySettingsPage(),
settings: const RouteSettings(name: '/settings'),
);
}
As well as the tests:
when(() => navigator.push(any())).thenAnswer((_) async {});
to:
when(() => navigator.push<void>(any())).thenAnswer((_) async {});
and finally the assertion:
verify(() => navigator.push(any(that: isRoute<void>(whereName: equals('/settings'))))).called(1);
to:
verify(() => navigator.push<void>(any<Route<void>>(that: isRoute<void>(whereName: equals('/settings'))))).called(1);
I hope this helps.
from mockingjay.
Hey there,
Thank you all for flagging this! I'll look at this later today. If the solution is simple, expect a fix today as well 👍🏻
from mockingjay.
@jeroen-meijer any news about the investigation and solution?
from mockingjay.
I am also experiencing a similar issue.
from mockingjay.
sorry for the annoying alarm but so am I..
The following _TypeError was thrown running a test:
type 'Null' is not a subtype of type 'Future<Object?>'
When the exception was thrown, this was the stack:
#0 MockNavigator.pushNamed (package:flutter/src/widgets/navigator.dart:4094:14)
#1 _MockNavigatorState.pushNamed (package:mockingjay/src/mock_navigator.dart:88:23)
from mockingjay.
I'm getting the same error as well, though I did have to change line 22 to get this to run:
static Route<void> route() {
from mockingjay.
The test will pass when changing to the previous versions.
mocktail v0.2.0
mockingjay v0.2.0
There is a change related to this issue in the mocktail v0.3.0 update.
- BREAKING feat: add support for type argument matching
felangel/mocktail#66 (comment)
from mockingjay.
Related Issues (17)
- feat: MockNavigatorProvider auto complete to support lint rule sort_child_properties_last
- How to test the OpenContainer navigation? HOT 2
- Improving The example HOT 2
- Mockingjay blocks the update of Mocktail. HOT 1
- Dependency on mocktail 0.2.0 prevents from using with 0.3.0 HOT 2
- chore: Release v0.3.0 as a stable version
- NavigatorState is mockable? HOT 5
- Unable to use latest version of build_runner 2.3.2 with mockingjay HOT 1
- Unable to use mockingjay on a Windows host machine HOT 2
- Upgrade mockingjay deps to support mocktail v1.0.0 HOT 6
- Problems with Flutter `3.13.0`.
- fix: missing release for 0.4.0.
- docs: outdated README
- Updates for Flutter 3.16.0/Dart 3.2 HOT 6
- Navigator.pop is never called while it actually was
- Unable to work with routes using private types.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockingjay.