You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Web在Chrome运行时加载停滞,构建正常但浏览器报错求助

Flutter Web在Chrome加载卡住的解决办法
  • 关闭Chrome跨域限制:
    右键Chrome快捷方式→属性→目标栏末尾添加 --disable-web-security --user-data-dir="D:/ChromeTemp"(路径可自定义),重启Chrome后再启动Flutter Web。

  • 清理项目缓存并重新构建:
    执行以下命令:

    flutter clean
    flutter pub get
    flutter build web
    

    完成后用flutter run -d chrome重新启动。

  • 强制使用HTML渲染模式:
    启动时添加参数:

    flutter run -d chrome --web-renderer html
    

    或者在pubspec.yaml中配置默认渲染模式:

    web:
      renderer: html
    
  • 禁用Chrome扩展:
    关掉所有广告拦截、隐私防护类插件,这类插件大概率会阻断Flutter Web的资源加载。

  • 检查网络请求配置:
    若项目中有跨域API请求,确保后端已配置CORS允许当前域名访问,或者在本地开发时使用代理转发请求。

内容的提问来源于stack exchange,提问作者Tech Master

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 20:19:00