Jessy Yameogo 47d35a28b7
Fixed hot reload/restart crashes after closing browser tab on web-server device (#177026)
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
2025-10-20 16:49:35 +00:00
..