Repository: flutter
Issue: [Web]: `hot restart` gets stuck when changes are made to a class
Labels: tool,dependency: dart,t: hot reload,platform-web,has reproducible steps,P2,found in release: 3.7,found in release: 3.11,team-web,triaged-web

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- Please tell us exactly how to reproduce the problem you are running into. -->

1. Upgraded to new version of Flutter (2.0.3)
2. Running flutter app in chrome
## Code 
```
class SomeClass {
  static addMeta(String tags) {
    html.Element? htmlVal = html.document.querySelector('head');
    htmlVal?.setInnerHtml(
      tags,
      validator: AllowAll(),
    );
  }
}

class AllowAll implements html.NodeValidator {
  @override
  bool allowsAttribute(
      html.Element element, String attributeName, String value) {
    return true;
  }

  @override
  bool allowsElement(html.Element element) {
    return true;
  }
}
```

## Logs
<details>
<summary>Logs</summary>

<!--
      Include the full logs of the commands you are running between the lines
      with the backticks below. If you are running any "flutter" commands,
      please include the output of running them with "--verbose"; for example,
      the output of running "flutter --verbose create foo".
-->

```
/Volumes/aayush/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/Volumes/aayush/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root
/Volumes/aayush/flutter/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
/var/folders/0x/x_vhjhhx4158f5p25jstgzbw0000gn/T/flutter_tools.KzsueB/flutter_tool.kXtMAk/app.dill --libraries-spec
file:///Volumes/aayush/flutter/bin/cache/flutter_web_sdk/libraries.json --packages
/Users/aayush/Desktop/coderaayush/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-root /var/folders/0x/x_vhjhhx4158f5p25jstgzbw0000gn/T/flutter_tools.KzsueB/flutter_tools.svHG3q
--filesystem-scheme org-dartlang-app --initialize-from-dill build/b1b715402d823b7fd5c2b68d2edcb2ce.cache.dill.track.dill --platform
file:///Volumes/aayush/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk_sound.dill --sound-null-safety
[  +20 ms] <- compile org-dartlang-app:/web_entrypoint.dart

[+43309 ms] Waiting for connection from debug service on Chrome... (completed in 48.5s)
[   +2 ms] Synced 36.7MB.
[   +2 ms] <- accept
[   +3 ms] Caching compiled dill
[+1589 ms] Using Google Chrome 89.0.4389.90 

[+10795 ms] [CHROME]:
[   +2 ms] [CHROME]:DevTools listening on ws://127.0.0.1:55369/devtools/browser/d9385e66-90e9-4f84-88fd-52a2a491e78c
[+3016 ms] DwdsInjector: Received request for entrypoint at http://localhost:55335/main_module.bootstrap.js
[  +10 ms] MetadataProvider: Loading debug metadata...
[  +45 ms] MetadataProvider: Loaded debug metadata
[  +19 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:55335/main_module.bootstrap.js
[+6312 ms] DevHandler: Debug service listening on ws://127.0.0.1:55390/XgeHLh-hctQ=/ws

[  +82 ms] Debug service listening on ws://127.0.0.1:55390/XgeHLh-hctQ=/ws
[   +4 ms] 💪 Running with sound null safety 💪
[  +40 ms] 🔥  To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".
[+43309 ms] Waiting for connection from debug service on Chrome... (completed in 48.5s)
[   +2 ms] Synced 36.7MB.
[   +2 ms] <- accept
[   +3 ms] Caching compiled dill
[+1589 ms] Using Google Chrome 89.0.4389.90 

[+10795 ms] [CHROME]:
[   +2 ms] [CHROME]:DevTools listening on ws://127.0.0.1:55369/devtools/browser/d9385e66-90e9-4f84-88fd-52a2a491e78c
[+3016 ms] DwdsInjector: Received request for entrypoint at http://localhost:55335/main_module.bootstrap.js
[  +10 ms] MetadataProvider: Loading debug metadata...
[  +45 ms] MetadataProvider: Loaded debug metadata
[  +19 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:55335/main_module.bootstrap.js
[+6312 ms] DevHandler: Debug service listening on ws://127.0.0.1:55390/XgeHLh-hctQ=/ws

[  +82 ms] Debug service listening on ws://127.0.0.1:55390/XgeHLh-hctQ=/ws
[   +4 ms] 💪 Running with sound null safety 💪
[  +40 ms] 🔥  To hot restart changes while running, press "r" or "R".
[        ] For a more detailed help message, press "h". To quit, press "q".
[+148709 ms] Performing hot restart...
[  +14 ms] Initializing file store
[  +29 ms] Skipping target: gen_localizations
[   +7 ms] complete
[  +13 ms] Scanned through 521 files in 11ms
[        ] Waiting for connection from debug service on Chrome...
[   +5 ms] <- recompile org-dartlang-app:/web_entrypoint.dart 431af7b4-4c2d-48be-8b75-52f9bf780c12
[        ] package:coderaayush/helpers/flutter_hamlet.dart
[        ] <- 431af7b4-4c2d-48be-8b75-52f9bf780c12
[ +361 ms] Waiting for connection from debug service on Chrome... (completed in 365ms)
[        ] Synced 0.1MB.
[        ] <- accept
[  +10 ms] DwdsVmClient: Attempting a hot restart
[   +2 ms] DwdsVmClient: Attempting to disabling breakpoints and resume the isolate
[  +29 ms] DwdsVmClient: Successfully disabled breakpoints and resumed the isolate
[        ] DwdsVmClient: Attempting to get execution context ID.
[        ] DwdsVmClient: Got execution context ID.
[        ] DwdsVmClient: Issuing $dartHotRestart request.
[ +299 ms] DwdsVmClient: $dartHotRestart request complete.
[        ] DwdsVmClient: Waiting for Isolate Start event.
[+7924 ms] Ignoring terminal input: "r" because we are busy.
[+28494 ms] Ignoring terminal input: "r" because we are busy.
```

<!-- If possible, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 2.0.3, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-NP)
    • Flutter version 2.0.3 at /Volumes/aayush/flutter
    • Framework revision 4d7946a68d (2 days ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at /Users/aayush/Library/Android/sdk
    • Platform android-30, build-tools 30.0.1
    • ANDROID_HOME = /Users/aayush/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
```

</details>