3

I'm getting FirebaseException is CAUGHT BY FLUTTER TEST FRAMEWORK, while flutter integration test is being run.!

Can anybody help in understading how to ignore the FirebaseException in integration test and continue the rest of execution?

I tried below walkaround,

Future<void> restoreFlutterError(Future<void> Function() call) async {
  FlutterError.onError = (FlutterErrorDetails data) {
    if (data.exception is FirebaseException) {
      return;
    }
    FlutterError.presentError(data);
  };
}

And called above method in testWidgets by

testWidgets('test execution', (tester) async {
    await restoreFlutterError(() async {
      app.main();
      await tester.pumpAndSettle(const Duration(seconds: 10));
    });
    ...
    ...
});

But getting below error.!

 A test overrode FlutterError.onError but either failed to return it to its original state, or had unexpected additional errors that it could not handle. Typically, this is caused by using expect() before restoring FlutterError.onError.

Any helps appreciated.!

Jagadeesh
  • 358
  • 5
  • 17

0 Answers0