Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: Hot Reload gets stuck in Visual Studio Code

UPDATE: I tried with another clean new project. Hot reload works fine.

Every time I perform a hot reload on my VS Code, the hot reload gets stuck with the following message. Anyone knows the problem?

Error Message

These are the things that I have done.

  1. Terminal: Ran flutter doctor -- (everything ok, except a warning sign of a little bit outdated Xcode. I'm using Xcode 11.1.0)
  2. Restarted VS
  3. Restarted the entire machine
  4. Running on both simulator and physical iPad

These are my specs:

  1. Macbook Pro Early 2015
  2. macOS Mojave
  3. VS Code 1.52.1 (latest)
  4. Flutter extension v3.18.1 (latest)
  5. Dart v3.18.1 (latest)
  6. Xcode 11.1.0 (not latest)

Debug console:

Launching lib/main.dart on iPad Pro (9.7-inch) in debug mode...
lib/main.dart:1
Xcode build done.                                           82.4s
Connecting to VM Service at ws://127.0.0.1:51095/_Dfl55VaXyE=/ws
like image 755
fendy3d Avatar asked Jan 18 '21 09:01

fendy3d


People also ask

How do you do a hot reload Flutter in VS Code?

To perform a hot restart, run the Flutter: Hot Restart command from the Command Palette, or press Ctrl + Shift + F5 ( Cmd + Shift + F5 on macOS).

How do you stop the hot reload in Flutter?

Show activity on this post. Then, after being at Flutter section, look for "App Execution" and there you have to uncheck the box "Perform hot reload on save". Then click OK and that's it.

How hot does Flutter reload work?

1. Hot Reload allows us to see the reflected change after bug fixes, building User interfaces and even adding certain features to the app without running your application afresh over and over again. Hot restart destroys the preserved State value and set them to their default.


3 Answers

I was try open DevTools in the browser and press Hot reload button and it's working!
enter image description here

like image 107
Nhật Trần Avatar answered Nov 11 '22 09:11

Nhật Trần


if you are using Listview.builder or Grideview.builder then comment it out or remove that code block.

sometimes it happens because of the unbounded height problem of listview.builder and hot reload get stuck and fail to compile the code.

like image 33
Mashood .h Avatar answered Nov 11 '22 08:11

Mashood .h


Not sure which Flutter version you were using but you could be running into a case of https://github.com/flutter/flutter/issues/84347 which is related to isolates getting somehow stuck during hot reload. I don't know the audioplayers library but I assume it uses an isolate in the background.

like image 27
kuhnroyal Avatar answered Nov 11 '22 09:11

kuhnroyal