Flutter Web调试模式下随机TypeError编译崩溃问题求助
Flutter Web调试模式间歇性
TypeError: Cannot read properties of undefined问题求助 正在为现有Flutter应用添加Web支持,调试模式下会间歇性触发TypeError: Cannot read properties of undefined (reading 'foo')错误,其中foo的内容随机变化,可能是插件相关类、自定义类或Flutter SDK类,该错误会直接导致应用编译崩溃。
已排查的线索:
- 仅在调试模式下出现,Release模式无此问题
- 在Flutter 3.27.4、3.29.0等多个版本中均存在
- 错误发作无规律,无法稳定复现
- 新建空白Flutter Web项目无法复现该问题
- 曾出现
main()函数被该错误影响的情况 - 执行
flutter clean命令后问题未得到解决
附项目的index.html代码:
<!DOCTYPE html> <html> <head> <!-- Base & Meta --> <base href="/"> <meta charset="UTF-8" /> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="description" content="A new Flutter project."> <!-- iOS Meta --> <meta name="mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-title" content="deercast" /> <link rel="apple-touch-icon" href="icons/Icon-192.png" /> <link rel="icon" type="image/png" href="favicon.png" /> <link rel="manifest" href="manifest.json" /> <title>app_name</title> <!-- Styles --> <link rel="stylesheet" href="splash_style.css" /> <!-- External Scripts --> <script src="gleap_loader.js" defer></script> <script src="splash_remover.js" defer></script> <script src="./assets/packages/mixpanel_flutter/assets/mixpanel.js" defer></script> </head> <body> <script src="flutter_bootstrap.js" defer></script> </body> </html>
内容的提问来源于stack exchange,提问作者Mehmet Karanlık
相关产品推荐
相关产品推荐

