Flutter catching all unhandled exceptions

Okay I figured out what’s going on. Had a look at some related Flutter issues:

flutter tool is too aggressive about catching exceptions

Make hot mode a little less aggressive about catching errors

Break on “unhandled” exceptions when a debugger is attached

It looks like when in debug mode, the flutter framework catches a lot of exceptions, prints to the console (and sometimes shows in the UI itself in red and yellow), but doesn’t re-throw – so they are effectively swallowed and there’s no way for your own code to catch them. But, when you deploy in release mode, this doesn’t happen. So my minimal reproducible example does catch exceptions when built in release mode.

Leave a Comment