热重装无法在VS Code中流畅运行

时间:2019-12-19 19:16:28

标签: flutter dart visual-studio-code

我对Flutter还是很陌生,我在新机器上设置了flutter,但是“热重载”在这台机器上不起作用,flutter doctor随附未发现问题!, 我有一个基本的应用程序,该应用程序可以随风飘动,而我只是想更改文本。 调试控制台注册了我的ctrl + s,但说在94毫秒内重新加载了478个库中的0个。

这是我的日志:

Dart Code extension: 3.7.1
Flutter extension: 3.7.1 (activated)
VS Code: 1.41.0
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: C:\flutter\bin\cache\dart-sdk
    Ver: 2.7.0-dev.2.1
Flutter SDK:
    Loc: C:\flutter
    Ver: 1.12.13+hotfix.5
HTTP_PROXY: undefined
NO_PROXY: undefined

Fri Dec 20 2019 Log file started
[12:30:00 am] [FlutterRun] [Info] [Flutter] ==> [{"id":"20","method":"app.restart","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","fullRestart":false,"pause":false,"reason":"manual"}}]
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"25","progressId":"hot.reload","message":"Performing hot reload..."}}]
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"26","progressId":null,"message":"Syncing files to device Android SDK built for x86..."}}]
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"26","progressId":null,"finished":true}}]
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"25","progressId":"hot.reload","finished":true}}]
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== Reloaded 0 of 478 libraries in 79ms.
[12:30:00 am] [FlutterRun] [Info] [Flutter] <== [{"id":"20","result":{"code":0,"message":"Reloaded 0 of 478 libraries"}}]
[12:30:00 am] [Observatory] [Info] [Flutter] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Extension","event":{"type":"Event","kind":"Extension","extensionKind":"Flutter.Frame","isolate":{"type":"@Isolate","id":"isolates\/1643629586288923","name":"main","number":"1643629586288923"},"timestamp":1576781999244,"extensionData":{"number":36,"startTime":796900374,"elapsed":7377,"build":2586,"raster":4539}}}}
[12:30:09 am] [FlutterRun] [Info] [Flutter] ==> [{"id":"21","method":"app.restart","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","fullRestart":false,"pause":false,"reason":"manual"}}]
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"27","progressId":"hot.reload","message":"Performing hot reload..."}}]
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"28","progressId":null,"message":"Syncing files to device Android SDK built for x86..."}}]
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"28","progressId":null,"finished":true}}]
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== [{"event":"app.progress","params":{"appId":"9207e20d-3fab-4537-9fd6-1f6fcea334df","id":"27","progressId":"hot.reload","finished":true}}]
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== Reloaded 0 of 478 libraries in 95ms.
[12:30:09 am] [FlutterRun] [Info] [Flutter] <== [{"id":"21","result":{"code":0,"message":"Reloaded 0 of 478 libraries"}}]
[12:30:09 am] [Observatory] [Info] [Flutter] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Extension","event":{"type":"Event","kind":"Extension","extensionKind":"Flutter.Frame","isolate":{"type":"@Isolate","id":"isolates\/1643629586288923","name":"main","number":"1643629586288923"},"timestamp":1576782008085,"extensionData":{"number":37,"startTime":805737281,"elapsed":10712,"build":6024,"raster":4393}}}}
Log file ended

它不能与ctrl + s或“闪光灯”按钮一起使用

奇怪!当我使用flutter run然后r时 我注意到的另一件事是无需调试即可运行,而不是无需调试即可开始

1 个答案:

答案 0 :(得分:-1)

您需要创建一个根窗口小部件以使热重新加载工作变得一帆风顺。如果您没有根窗口小部件(或在热重装不起作用时),则可以使用热重装按钮。 有关更多详细信息,请访问: https://flutter.dev/docs/development/tools/hot-reload#recent-ui-change-is-excluded