Open krisztianodor opened 2 years ago
Thanks for the repro code, that's very helpful.
I can reproduce this issue. I think it has something to do with how the app runs when started with the --machine
option (which IDEs use to enable control of the app).
This isn't specific to web apps. I saw the same thing when running the app in an Android emulator. I had verbose logging on, but the same print statements ran:
[ +333 ms] Hot restart performed in 1,180ms.
[ +1 ms] Restarted application in 1,198ms.
[ +309 ms] I/flutter (18510): MyApp initState called
[ +9 ms] I/flutter (18510): MyApp build called
[+24477 ms] I/flutter (18510): MyApp build called
The second build was triggered when the mouse entered the frame of the emulator.
@DanTup have you observed anything similar with VS Code?
I don't seem to be able to repro this with VS Code, although it's a little similar to https://github.com/Dart-Code/Dart-Code/issues/3498 where additional builds were happening that was caused by VS Code calling service extension toggles (it was sending them after a restart even if they had not been changed from the default values).
Thanks, that's interesting. It could be service extension calls. I think I saw a bunch of them in the log. It isn't obvious why that would trigger a build, though.
If you enable something like painting overlays I assume it needs to rebuild. I figured maybe it was always triggering the rebuild even if the value didn't really change (which perhaps could be optimised in Flutter if that is the case, but it seemed needless to send them so I changed that in VS Code anyway).
Any updates on it? Looks like idea calls for flutter web initState twice in my case
It's not happen only on Web, it's still on Android.
Any updates on this? The issue seems to be still here
@jwren do you have any opinion on this? https://github.com/flutter/flutter-intellij/issues/7286 might have the same root cause
Thanks!
Steps to Reproduce
This is the output of the Intellij console after step 3:
Complete code to reproduce the problem:
By the way if i run the app directly using the flutter cli (outside Intellij) with the following command and i hit 'r' to trigger a hot restart, then the hot restart is waiting and executed only if the focus is on the browser. And there are no unnecessary builds in the hot restart instance even if i do something on the site. I don't think that's a coincidence.
flutter run -d chrome
Version info
I can reproduce this problem at flutter stable, dev and master channel too.