admin管理员组文章数量:1415458
I've been trying to debug my Windows application, but it doesn't render properly. Meanwhile, the release version of the app works just fine. This is the debug view: Windows app with render problems
Coincidentally, this happened right after I added a main()
method to a file other than main.dart
.
I tried updating all dependencies, both Flutter and VS Build Tools, plus I ran flutter clean
in the terminal, to no avail. Creating a new Flutter project doesn't cause the issue, though. I'm also using this .gitignore
file, so checking out previous commits didn't solve the issue: /.gitignore
I've been trying to debug my Windows application, but it doesn't render properly. Meanwhile, the release version of the app works just fine. This is the debug view: Windows app with render problems
Coincidentally, this happened right after I added a main()
method to a file other than main.dart
.
I tried updating all dependencies, both Flutter and VS Build Tools, plus I ran flutter clean
in the terminal, to no avail. Creating a new Flutter project doesn't cause the issue, though. I'm also using this .gitignore
file, so checking out previous commits didn't solve the issue: https://github/flutter/flutter/blob/master/.gitignore
1 Answer
Reset to default 1Normally, main() is called only once and serves as the entry point, it initializes Flutter and starts the app. Once the app starts, main() is not called again unless explicitly restarted.
main() can be called multiple times in 3 cases
1- In Flutter debug mode(during development), when you do a Hot Restart (NOT IN DESKTOP DEV), the app fully restarts and calls main() again.
2- One can explicitly call main() inside the app, I do not recommend for security..multiple instances of the app running in memory..
3- After a Crash
Solutions:
1- for desktop apps try to restarted manually to recall the main().
2- call runApp() multiple times without restarting main(), but it will replace the widget tree
本文标签: debuggingFlutter doesn39t render Windows app in debug modeStack Overflow
版权声明:本文标题:debugging - Flutter doesn't render Windows app in debug mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745171376a2645994.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论