Member-only story

How To Catch Pesky Layout Errors

Fred Grott
5 min readFeb 14, 2022

--

There is one more trick, by just running zones to catch non-framework errors and using a plugin like catcher to show a user facing error report. Let me show you how to use a new trick to catch a layout error.

Background

This is the standard zones and catcher plugin setup:

We can use the catcher plugin that way, as internally the catcher plugin setup a zone and setups a FlutterError instance:

But to catch layout errors during development, we need one more twist in it.

Catching Layout Errors During Development

The secret trick to catch layout errors is to add another FlutterError definition via the AppRootWidget:

--

--

Fred Grott
Fred Grott

No responses yet