You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'd suggest just wrapping your test widgets in a MaterialApp with a Routemaster setup, that's what I do. I always prefer using real dependencies and only mocking when absolutely necessary.
If you don't want to use your real routing setup in the test, you can always inject a fake home route which has just the widget you want to test.
I have a widget containing a button which navigates using routemaster:
Then, in my widget tests for the widget:
However, this will throw an error since the build context has no routemaster in the test widget:
Is there a way to mock/stub Routemaster for use in widget tests like this?
The text was updated successfully, but these errors were encountered: