1

How do I mock firebase_auth methods in my integration tests?

I am getting the following error:

MissingPluginException(No implementation found for method Auth#registerIdTokenListener on channel plugins.flutter.io/firebase_auth)

The integration test currenlty doesn't do much:

void main() async {

  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  setupFirebaseAuthMocks();
  await Firebase.initializeApp();
  MockFirebaseAuth(signedIn: false);

  app.main();

}

setupFirebaseAuthMocks(); method I got form this solution: https://stackoverflow.com/a/64730015/6266336

It helped to overcome similiar issue but with Firebase#initializeCore method.

6
  • 2
    Stop and re-run your application once. Commented Jan 14, 2022 at 11:59
  • Make sure you're using the latest version of the package from pub.dev and restart your application with a fresh install. Let me know if it still doesn't works Commented Jan 14, 2022 at 12:04
  • @Diwyansh, i am running just the test, will the re-run of the application have any influence on that? Commented Jan 14, 2022 at 12:08
  • There are some dependencies that complies there code when installing the app if you add such a dependency and just restart the app then it will throw No implementation error Commented Jan 14, 2022 at 12:19
  • @MuhammadHussain, I have upgraded firebase_auth to the current version and started the app. But as i mentioned before, the error doesn't occur while running the app, but when running the test.... Commented Jan 14, 2022 at 12:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.