Fix StateError during AOT execution by statically compiling injected client payload (#2804) This PR resolves an issue where `webdev serve` crashes with a `StateError` when attempting to load `client.js` in AOT-compiled environments. **Root Cause:** Previously, `DwdsInjector` relied on `Isolate.resolvePackageUri` to dynamically locate the `dwds` package on the file system at runtime. This fails within AOT snapshots because the injected client could not be resolved. **Changes:** - Bypassed the need for dynamic runtime file resolution by generating a statically compiled asset. - Updated `tool/build.dart` to automatically bundle the transpiled `client.js` into a new `lib/src/handlers/injected_client_js.dart` file. The Javascript payload is encoded line-by-line using `jsonEncode` to preserve code readability. - Refactored the `DwdsInjector` middleware to serve the statically guaranteed memory string. - Added verification tests to enforce strict checksum equivalency between `client.js` file and generated `injected_client_js.dart`. Related to https://github.com/dart-lang/webdev/issues/2761
| Package | Description | Version |
|---|---|---|
| dwds | A service that proxies between the Chrome debug protocol and the Dart VM service protocol. | |
| frontend_server_client | Client code to start and interact with the frontend_server compiler from the Dart SDK. | |
| webdev | A CLI for Dart web development. Provides an easy and consistent set of features for users and tools to build and deploy web applications with Dart. |
For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.