gpt4 book ai didi

Flutter web 需要刷新浏览器以反射(reflect)热重启后的变化

转载 作者:行者123 更新时间:2023-12-03 13:30:10 32 4
gpt4 key购买 nike

我正在开发一个 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.

请帮我解决这个问题。

最佳答案

我已经解决了这个问题,虽然我仍然不知道是什么原因。我用有效的初始代码替换了 main.dart 文件。然后我换回了我的代码,问题就消失了。

关于Flutter web 需要刷新浏览器以反射(reflect)热重启后的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62264783/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com