set static method
bool
set({
- required FlutterExceptionHandler? handler,
- ErrorWidgetBuilder? builder,
- ReportErrorHandler? report,
Set a handler and the report
Implementation
static bool set({
required FlutterExceptionHandler? handler,
ErrorWidgetBuilder? builder,
ReportErrorHandler? report,
}) {
// 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 (builder != null) {
// Change the widget presented when another widget fails to build.
ErrorWidget.builder = builder;
reset = true;
}
// Something was set;
return reset;
}