configureErrorWidgetBuilder function

void configureErrorWidgetBuilder({
  1. required bool isProduction,
  2. ErrorWidgetBuilder? productionBuilder,
})

Implementation

void configureErrorWidgetBuilder({
  required bool isProduction,
  ErrorWidgetBuilder? productionBuilder,
}) {
  ErrorWidget.builder = (details) {
    final message = kReleaseMode && isProduction
        ? ''
        : '${_stringifyException(details.exception)}\n'
            'See also: https://flutter.dev/docs/testing/errors';
    final dynamic exception = details.exception;
    if (isProduction && productionBuilder != null) {
      return productionBuilder(details);
    }
    return ErrorWidget.withDetails(
      message: message,
      error: exception is FlutterError ? exception : null,
    );
  };
}