ErrorWidget.builder = (FlutterErrorDetails details) {
return YourCustomWidget(
details: details,
);
};
runApp(const MyApp());
//YourCustomWidget
class YourCustomWidget extends StatelessWidget {
const YourCustomWidget({
Key? key,
required this.details,
}) : super(key: key);
final FlutterErrorDetails details;
@override
Widget build(BuildContext context) {
return Material(
child: SafeArea(
child: Container(
color: Colors.green,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
details.exception.toString(),
style: const TextStyle(
fontWeight: FontWeight.bold,
color: white,
),
),
],
),
),
),
);
}
}