Search code examples
flutterflutter-buildrun-appflutter-hotreload

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

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