Flutter Hot Reload and Hot Restart do not always work
5,989
Solution 1
My problem was a bad import
import 'file:///C:/Users/plest/StudioProjects/the_spot/lib/pages/home_page/Map/map.dart' ;
instead of
import 'package:the_spot/pages/home_page/Map/map.dart' ;
I don't know why the import changed by itself...
Solution 2
try changing your channel, for example run flutter channel master
.
worked for me

Author by
Milvintsiss
Updated on December 02, 2022Comments
-
Milvintsiss about 19 hours
For now one week, sometimes when I HotReload my changes are not applied (the log says it's been HotReload but in fact, they are not) and the same when I HotRestart so I'm forced to stop and re-run the app (and sometimes to delete the build)!
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, v1.15.17, on Microsoft Windows [version 10.0.17763.1098], locale fr-FR) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [√] Chrome - develop for the web [√] Android Studio (version 3.6) [√] Connected device (3 available) • No issues found!
I run my app on Android Emulator 9 Pie.
EDIT: I tried to invalidate the cache of AndroidStudio and restart, and also tried on another emulator but it didn't solve the issue...
-
Ricardo Markiewicz over 2 yearsThis may be tricky because of the hot reload may depend on the context. For instance, if you have a listen over a stream in the initState of a State class, the initState is not called again on hot reload. For the hot restart, I never have problems, so I can not help there.
-
i6x86 over 2 yearsThis sounds more like an IDE issue? Which one you use and what OS?
-
Milvintsiss over 2 yearsall is in my Flutter Doctor Log, I'm on windows and I use Android Studio
-
Darish over 2 yearsif you add new dependencies into yaml file, then hot reload/restart will not work. You should stop and run the project again. Otheriwise hot restart will work for all scanario and hot reload will work for build method changes and non static pure dart changes.
-
Chinky Sight over 2 yearshad you tried hot reloading or hot restarting after
flutter clean
and yeah I guess you are working with flutter web which is in beta at the moment which might be the problem. -
Milvintsiss over 2 years@Darish oh yes it should but as I sayd it don't.
-
Milvintsiss over 2 years@ChinkySight a flutter clean will not change anything to HotReload or Restart because Flutter clean delete the build and the principle of HotRestart/Reload is to do not rebuild the project to gain time... The fact Flutter Web is in Beta was a good idea but I removed the Web support and the issue still here :(
-
Michel Feinstein over 2 yearsDoes this happen for all your projects or just one? Have you tried to create a project from scratch, with nothing in there and test?
-
-
Alif over 1 yearThis worked perfectly for me, I waste my 1 hour on this stupid problem. Thanks
-
user1034912 over 1 yeari'm just on hello world project and this is happening!
-
Saravanan S about 1 yearIt's working for me with below scenario, once change the channel, also check your version also. If it is old just upgrade your flutter version. >$flutter upgrade