'Flutter Hot Reload and Hot Restart do not always work

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...



Solution 1:[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:[2]

try changing your channel, for example run flutter channel master . worked for me

Solution 3:[3]

Solution is always depends the problem. Many reasons may cause the issue.

Method 1 : Re-install Flutter Plugin

  1. This is the best solutions for your problem. First of all, uninstall the flutter.
  2. File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
  3. Select Flutter. Uninstall (You might restart the IDE)
  4. Now re-install the flutter.
  5. File -> Settings -> Plugins (on MacOs: Preference -> Plugins)
  6. Select ‘Browse repositories’.
  7. Now search for ‘Flutter’. Select ‘Flutter’.
  8. Install.

Method 2 : The android project should be on running stage on android studio or your IDE

Method 3 : Make sure your application is open and not closed by you after running.

  • The application should be active, phone is not locked and light is on. Hot Reload will not work if you close the application.

Solution 4:[4]

uninstall & after re-install flutter plugin from setting will make this right

Solution 5:[5]

After installation. I rebooted my mac and suddenly it was way faster!

Solution 6:[6]

It could be a proxy problem. Please try to close it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Milvintsiss
Solution 2 SO 80
Solution 3 Paresh Mangukiya
Solution 4 Murshid Ahamed
Solution 5 tbrodbeck
Solution 6 Edison xu