Flutter:使用自定义ErrorWidget [英] Flutter: Use custom ErrorWidget

查看:482
本文介绍了Flutter:使用自定义ErrorWidget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以显示(生产中)自定义错误窗口小部件,而不是显示死亡的红色屏幕?我不会更改框架代码,而且即使我们试图在编程时没有错误,我们也不能保证它会发生.

Is there a way to display (in production) a custom error widget instead of the red screen of death? I will not change the framework code, plus even though we are trying to program without errors, we can't guarantee it to happen.

推荐答案

可以通过更改ErrorWidget.builder

ErrorWidget.builder = (errorDetails) {
  return Container(color: Colors.red);
}

这篇关于Flutter:使用自定义ErrorWidget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆