set static method
bool
set({
- FlutterExceptionHandler? handler,
- ErrorWidgetBuilder? screen,
- ReportErrorHandler? report,
- ParagraphStyle? paragraphStyle,
- TextStyle? textStyle,
- EdgeInsets? padding,
- double? minimumWidth,
- Color? backgroundColor,
Set a handler and the report
Implementation
static bool set({
FlutterExceptionHandler? handler,
ErrorWidgetBuilder? screen,
ReportErrorHandler? report,
i.ParagraphStyle? paragraphStyle,
i.TextStyle? textStyle,
EdgeInsets? padding,
double? minimumWidth,
Color? backgroundColor,
}) {
// Any subsequent assignments are not permitted.
_paragraphStyle ??= paragraphStyle;
_textStyle ??= textStyle;
_padding ??= padding;
_minimumWidth ??= minimumWidth;
_backgroundColor ??= backgroundColor;
// Once you're not allowed to reset the handlers, it can't be reversed.
if (!_allowNewHandlers) {
return false;
}
// Are you allowed to reset a handler?
// Only if an item was passed to reset.
var reset = false;
if (handler != null) {
// The default is to dump the error to the console. You can do more.
_onError = handler;
reset = true;
}
if (report != null) {
_errorReport = report;
reset = true;
}
if (screen != null) {
// Record the current 'Error Widget'
_oldBuilder ??= ErrorWidget.builder;
// Change the widget presented when another widget fails to build.
ErrorWidget.builder = screen;
reset = true;
}
// Something was set;
return reset;
}