mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This PR fixes crashes during hot reload/restart operations on web-server devices that occur when browser tabs are closed. Previously, the VM service would throw "Bad state: No element" errors when attempting operations with no connected clients. The fix introduces graceful handling on both sides: DWDS now catches NoClientsAvailableException in its hot reload/restart operations and returns structured JSON responses with a noClientsAvailable boolean flag instead of throwing exceptions. Flutter Tools reads this flag via a helper method _checkNoClientsAvailable() and handles the scenario gracefully by displaying "Recompile complete. No client connected." while preserving the DWDS connection to automatically support browser reconnections without requiring a full restart of the Flutter tools. Fixes: https://github.com/flutter/flutter/issues/174791 Changes in DWDS (Parent PR): https://github.com/dart-lang/webdev/pull/2699 Follow up bug: https://github.com/dart-lang/sdk/issues/61757