Below is a snippet that seems to be a common culprit of this error:

You don’t see the explicit call to setState, but it’s called by showDialog.
The build method is not the right place to call showDialog because build
can be called by the framework for every frame, for example, during an
animation.

How to fix it?

One way to avoid this error is to use the Navigator API to trigger the dialog
as a route. In the example below, there are two pages. The second page has a
dialog to be displayed upon entry. When the user requests the second page from
clicking on a button on the first page, the Navigator pushes two routes in a
row – one for the second page and another for the dialog.

References

To learn more about how to debug errors, especially layout errors in Flutter, 
check out the following resources:

How to debug layout issues with the Flutter Inspector

Understanding constraints

Dealing with box constraints