Skip to content

Conversation

@jyameo
Copy link
Contributor

@jyameo jyameo commented Jan 5, 2026

ConnectRequest:

This PR removes the package:built_value dependency from ConnectRequest and replaces it with standard Dart JSON serialization.

Changes

  • Rewrote ConnectRequest as a simple Dart class with manual JSON serialization
  • Removed ConnectRequest from the @SerializersFor annotation in serializers.dart
  • Updated dev_handler.dart to serialize/deserialize ConnectRequest using the wire format ['ConnectRequest', request.toJson()] in _serializeMessage() and _deserializeMessage()
  • Updated client.dart to serialize ConnectRequest using wire format in _sendConnectRequest() and added ConnectRequest case to _deserializeEvent() helper
  • Changed constructor from builder pattern to named parameters
  • Removed generated file connect_request.g.dart

Testing

  • Existing tests for connection functionality continue to pass with the updated implementation
  • The change follows the same pattern used for HotReloadRequest, HotReloadResponse, HotRestartRequest, HotRestartResponse, ServiceExtensionRequest, and ServiceExtensionResponse

Fixes dart-lang/sdk#62293

@auto-submit
Copy link

auto-submit bot commented Jan 5, 2026

autosubmit label was removed for dart-lang/webdev/2736, because - The status or check suite unit_test; windows; Dart dev; PKG: dwds; `dart test --total-shards 3 --shard-index 2 --exclude-ta... has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit label Jan 5, 2026
Comment on lines 148 to 159
if (request is ConnectRequest) {
return ['ConnectRequest', request.toJson()];
} else if (request is HotReloadRequest) {
return ['HotReloadRequest', request.toJson()];
} else if (request is HotRestartRequest) {
return ['HotRestartRequest', request.toJson()];
} else if (request is ServiceExtensionRequest) {
return ['ServiceExtensionRequest', request.toJson()];
} else if (request is Map) {
// Already a raw message (e.g., ping)
return request;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: We could make this a switch statement over the types. Then in the future we could potentially use a sealed class hierarchy to be sure we are properly handling all the different requests and get feedback from the compiler when we accidentally miss one.
https://dart.dev/language/branches#exhaustiveness-checking

@jyameo jyameo merged commit 6572d24 into dart-lang:main Jan 6, 2026
44 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove built_value dependency from ConnectRequest

3 participants