Flutter: Hot Reload gets stuck in Visual Studio Code

Viewed 5308

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
5 Answers

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.

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

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.

Delete the emulator and run flutter clean from the terminal. Then create the emulator again and it will fix the issue.

Run flutter clean and run your project again and see if that solves the problem.

Related