debugging - Flutter doesn't render Windows app in debug mode - Stack Overflow

I've been trying to debug my Windows application, but it doesn't render properly. Meanwhile,

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

Share Improve this question asked Feb 21 at 1:12 Leonardo PechanskyLeonardo Pechansky 111 silver badge1 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

Normally, 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745171377a4614945.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信