The configurable factory for ErrorWidget.
When an error occurs while building a widget, the broken widget is replaced by the widget returned by this function. By default, an ErrorWidget is returned.
The system is typically in an unstable state when this function is called. An exception has just been thrown in the middle of build (and possibly layout), so surrounding widgets and render objects may be in a rather fragile state. The framework itself (especially the BuildOwner) may also be confused, and additional exceptions are quite likely to be thrown.
Because of this, it is highly recommended that the widget returned from this function perform the least amount of work possible. A LeafRenderObjectWidget is the best choice, especially one that corresponds to a RenderBox that can handle the most absurd of incoming constraints. The default constructor maps to a RenderErrorBox.
The default behavior is to show the exception's message in debug mode, and to show nothing but a gray background in release builds.
- FlutterError.onError, which is typically called with the same FlutterErrorDetails object immediately prior to this callback being invoked, and which can also be configured to control how errors are reported.
- flutter.dev/docs/testing/errors, more information about error handling in Flutter.
static ErrorWidgetBuilder builder = _defaultErrorWidgetBuilder;