Search code examples
flutterdartflutter-hotreload

tried hot reload but the changes are not reflected on the emulator


So I pulled this code from my branch and made few changes using vs code and tried hot reload but the changes are not reflected on the emulator. This is a flutter app using dart. I noticed something that said 'source control - 3 unsaved changes'. Does that have to do anything with this?


Solution

  • 1)Make sure you are having a stable internet connection, because sometimes the hot reload and code changes does not work when the internet connection is poor.

    2)check the current versions of Flutter, IDE(VS code), Emulator. If you are not updated to the latest version that might be an issue because of the bugs, errors are not fixed in the older versions. command for upgrading the flutter is [flutter upgrade or flutter upgrade --force]

    3)Finally in this case if the code is not properly formatted then you can't perform the hot reload function. try the flutter command to format code easily, From the terminal just run [flutter format lib] and it will format all the dart files in the lib directory and subdirectory. You can change lib with whatever directory you like.

    4)on top of all still the issue is not resolved try to run command [dart fix --dry-run , dart fix --apply] visit the the official documentation of flutter and dart for more references.

    5)I hope this will help you to sort out the issue, if not get back to us. Also replay back which method or solution helps you to solve the issue.