hitTestWarningShouldBeFatal property Null safety
Whether warnings relating to hit tests not hitting their mark should be fatal (cause the test to fail).
Some methods, e.g. tap, have an argument
warnIfMissed which causes a
warning to be displayed if the specified Finder indicates a widget and
location that, were a pointer event to be sent to that location, would not
actually send any events to the widget (e.g. because the widget is
obscured, or the location is off-screen, or the widget is transparent to
This warning was added in 2021. In ordinary operation this warning is non-fatal since making it fatal would be a significantly breaking change for anyone who already has tests relying on the ability to target events using finders where the events wouldn't reach the widgets specified by the finders in question.
However, doing this is usually unintentional. To make the warning fatal, thus failing any tests where it occurs, this property can be set to true.
Typically this is done using a
flutter_test_config.dart file, as described
in the documentation for the flutter_test library.
static bool hitTestWarningShouldBeFatal = false;