【发布时间】:2020-09-27 13:53:21
【问题描述】:
我正在开发一个 Flutter Web 项目并在 chrome 上运行它。每次我进行更改并按r 时,我都会看到以下几行:
Performing a hot restart...
(This is taking an unexpectedly long time.) -
然后应用程序将完全冻结,热重启将永远持续下去。然后我需要刷新 chrome 浏览器以查看更改。刷新浏览器后,终端给了我以下信息:
Performing hot restart...
216,378ms (!)
Restarted application in 216,380ms.
我正在使用 VS 代码。如果我通过Run > Run Without Debugging运行项目,文件保存时会热重启,我仍然需要刷新浏览器。
我尝试通过flutter run -d web-server 在服务器上运行,网页不再冻结,但仍需要刷新才能显示更改。如果我使用flutter fun -d web-server --verbose 运行,这是终端输出。
[+6946 ms] Performing hot restart...
[ +61 ms] Scanned through 534 files in 59ms
[ +1 ms] Syncing files to device Web Server...
[ +1 ms] <- recompile org-dartlang-app:/web_entrypoint.dart f4f6967d-4b7d-4fa1-ba9a-58ae7c209d8f
[ ] <- f4f6967d-4b7d-4fa1-ba9a-58ae7c209d8f
[ +22 ms] Syncing files to device Web Server... (completed in 24ms)
[ +3 ms] Synced 0.0MB.
[ +3 ms] <- accept
[ +1 ms] Recompile complete. Page requires refresh.
[ +2 ms] Performing hot restart... (completed in 0.1s)
[ +1 ms] Restarted application in 100ms.
该问题并未在项目开始时出现。我不确定是什么导致了这个问题。这是我的医生输出:
[√] Flutter (Channel beta, 1.18.0-11.1.pre, on Microsoft Windows [Version 10.0.18362.836], locale en-SG)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.45.1)
[√] Connected device (2 available)
! Doctor found issues in 1 category.
请帮我解决这个问题。
【问题讨论】:
标签: flutter flutter-web