I am using Firebase Crashlytics in a Flutter app and I want to write a unit test for the code snippet below:
if (queryResult.hasException) {
String msg = queryResult.exception.toString();
await FirebaseCrashlytics.instance.recordError(error, stackTrace, reason: message, fatal: true);
throw Exception("Query execution failed due to: " + msg);
}
Is there a way to mock the Firebase instance and don't record the error in my unit tests?
The following exception is thrown if I don't mock it:
No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()