10

I am working on a flutter web project and runs it on chrome. Every time I make changes and press r, I will see the following lines:

Performing a hot restart...                                               
(This is taking an unexpectedly long time.)       -

The app will then freeze completely and the hot restart just takes forever. I then need to refresh the chrome browser to see the changes. After I refresh the browser, the terminal gives me the following:

Performing hot restart...                                               
216,378ms (!)
Restarted application in 216,380ms.

I am using VS Code. If I run the project via Run > Run Without Debugging, which alto hot restart upon file save, I still need to refresh the browser.

I have tried running on the server via flutter run -d web-server, the web page doesn't freeze anymore but still requires refresh to show changes. Here is the terminal output if I run with flutter fun -d web-server --verbose.

[+6946 ms] Performing hot restart...
[  +61 ms] Scanned through 534 files in 59ms
[   +1 ms] Syncing files to device Web Server...
[   +1 ms] <- recompile org-dartlang-app:/web_entrypoint.dart f4f6967d-4b7d-4fa1-ba9a-58ae7c209d8f
[        ] <- f4f6967d-4b7d-4fa1-ba9a-58ae7c209d8f
[  +22 ms] Syncing files to device Web Server... (completed in 24ms)
[   +3 ms] Synced 0.0MB.
[   +3 ms] <- accept
[   +1 ms] Recompile complete. Page requires refresh.
[   +2 ms] Performing hot restart... (completed in 0.1s)
[   +1 ms] Restarted application in 100ms.

The issue didn't occur right at the beginning of the project. I am not sure what I have touched to cause this problem. Here is my doctor output:

[√] Flutter (Channel beta, 1.18.0-11.1.pre, on Microsoft Windows [Version 10.0.18362.836], locale en-SG)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.45.1)
[√] Connected device (2 available)

! Doctor found issues in 1 category.

Please help me with this issue.

Amir
  • 2,225
  • 2
  • 18
  • 27
Aiyox
  • 121
  • 1
  • 6
  • Please share your code. It seems there is nothing around this at the moment according to [this](https://github.com/flutter/flutter/issues/50517), but it seems like its on its way to being resolved at some point. – Christopher Moore Jun 08 '20 at 15:49
  • @ChristopherMoore Thanks for the reply! I have a few thousand lines of code so I'm not sure which part is relevant. The issue you have linked [here](https://github.com/flutter/flutter/issues/50517) is not the same as my problem either. I was not running in profile mode. – Aiyox Jun 09 '20 at 15:52
  • Show code that you've changed since the beginning of the project, otherwise it's nearly impossible to help you unless your issue is documented somewhere else. The issue I linked is running in profile mode but it may still be relevant. – Christopher Moore Jun 09 '20 at 16:03

3 Answers3

2

I have solved the problem although I still don't know what's the cause. I replaced the main.dart file with the initial code which works. I then replaced back my code and the issue is gone.

Aiyox
  • 121
  • 1
  • 6
0

I experienced the same and thought it was caused by Flutter web. For me in the end it´s this 'onBackgroundMessage' from the firebase messaging plugin which caused the issue https://github.com/FirebaseExtended/flutterfire/issues/4316

railon
  • 353
  • 2
  • 8
0

This might sound weird, I had the same issue, the chrome window needs some kind of mouse input, just move your cursor and it works just fine. My Flutter version is 2.5.3

Arun-
  • 846
  • 3
  • 22
  • 41