Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockNavigationObserver #61

Closed
ShivamMattoo33 opened this issue Jul 13, 2021 · 1 comment
Closed

MockNavigationObserver #61

ShivamMattoo33 opened this issue Jul 13, 2021 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@ShivamMattoo33
Copy link

Hi I am trying to add a test to Navigate from one page to another and hence am using NavigationObserver
But I am unable to make it work as it says
registerFallbackValue was not previously called to register a fallback value for Route<dynamic>flutter.
Could you Please give a sample test for this scenario

@felangel felangel self-assigned this Jul 13, 2021
@felangel felangel added the question Further information is requested label Jul 13, 2021
@felangel
Copy link
Owner

Hi @ShivamMattoo33 👋
Thanks for opening an issue!

You can do something like:

class FakeRoute<T> extends Fake implements Route<T> {}

void main() {
  setUpAll(() {
    registerFallbackValue(FakeRoute());
  });

  ...
}

You might also want to check out mockingjay which is intended to make mocking navigation easier and uses mocktail internally. 👍

Closing for now but let me know if you are still having trouble and I'm happy to continue the conversation 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants