builder method

Widget builder(
  1. FlutterErrorDetails details, {
  2. ParagraphStyle? paragraphStyle,
  3. TextStyle? textStyle,
  4. EdgeInsets? padding,
  5. double? minimumWidth,
  6. Color? backgroundColor,
  7. CustomPainter? customPainter,
})

Implementation

Widget builder(
  FlutterErrorDetails details, {
  i.ParagraphStyle? paragraphStyle,
  i.TextStyle? textStyle,
  EdgeInsets? padding,
  double? minimumWidth,
  Color? backgroundColor,
  CustomPainter? customPainter,
}) {
  String? message;
  try {
    //
    message = '\n\n${details.exception}\n\n';

    if (details.stack != null && stackTrace != null && stackTrace!) {
      //
      final stack = details.stack.toString().split('\n');

      final length = stack.length > 5 ? 5 : stack.length;

      final buffer = StringBuffer()..write(message);

      for (var i = 0; i < length; i++) {
        buffer.write('${stack[i]}\n');
      }
      message = buffer.toString();
    }
  } catch (e) {
    message = null;
  }
  return _ErrorRenderObjectWidget(
    message: message,
    error: details.exception,
    paragraphStyle: paragraphStyle ?? this.paragraphStyle,
    textStyle: textStyle ?? this.textStyle,
    padding: padding ?? this.padding,
    minimumWidth: minimumWidth ?? this.minimumWidth,
    backgroundColor:
        backgroundColor ?? this.backgroundColor ?? const Color(0xFFFFFFFF),
  );
}