builder property Null safety

ErrorWidgetBuilder builder
read / write

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.

See also:


static ErrorWidgetBuilder builder = _defaultErrorWidgetBuilder;