Engineering

How to catch ALL Flutter crashes?

| 1 min read

It's crucial for any mobile application to detect crashes. That’s how you are notified that something is not working as it should.

But do you catch ALL the crashes?

I will showcase how to do it with Firebase Crashlytics, but you can easily replace it with any other crash reporter.

Firstly, you should catch all the crashes you didn’t catch somewhere in your code. That covers exceptions in the Flutter.

Zrzut ekranu 2022-10-20 o 10.14.09.png

Then you need to catch all the crashes in Zone that were not caught by the Flutter Framework. Handling crashes in Zone covers exceptions in the native layer.

Zrzut ekranu 2022-10-20 o 14.52.16.png

Finally, you need to catch all the crashes in the Isolate. Handling crashes in Isolate covers exceptions in Dart. Remember that if you have created more Isolates, you should also add handling to them.

Zrzut ekranu 2022-10-20 o 10.15.45.png

Perfect! Now you can be sure that all the crashes in your code will be caught and reported.

PS. I wish you as few crashes as possible 🤞