How to crash Flutter App for Android and iOS (to test Firebase Crashlytics)?

0

Issue

I want to test out crash report using Firebase Crashlytics in my Flutter App. I need to Fatal crash my flutter app for both Android and iOS programmatically. Any idea?

Solution

You should be able to throw a Dart exception by doing this anywhere in your Flutter app:

throw Exception("This is a crash!");

Or by using an arbitrary object:

throw "This is a crash!";

You can find more info about dart exceptions in the language tour and if you want, you can create your own custom Exception type as explained in this SO answer

Answered By – Xavi Rigau

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More