Skip to content

Conversation

@jyameo
Copy link
Contributor

@jyameo jyameo commented Jan 13, 2026

DevToolsRequest/DevToolsResponse

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

Changes

  • Rewrote DevToolsRequest and DevToolsResponse as simple Dart classes with manual JSON serialization
  • Removed DevToolsRequest and DevToolsResponse from the @SerializersFor annotation in serializers.dart
  • Updated serialization logic in dev_handler.dart to use the wire format ['DevToolsRequest', json] and ['DevToolsResponse', json]
  • Updated extension_debugger.dart to manually deserialize DevToolsRequest
  • Updated client-side logic in client.dart to use named parameters and toJson() for serialization
  • Updated debug_session.dart in the extension to handle the new class structure
  • Removed generated file devtools_request.g.dart

Testing

  • Existing tests for devtool requests continue to pass with the updated implementation
  • Follows the same pattern used for DebugEvent, ConnectRequest, RunRequest, BuildResult, and other RPC classes

Fixes dart-lang/sdk#62296

@auto-submit
Copy link

auto-submit bot commented Jan 13, 2026

autosubmit label was removed for dart-lang/webdev/2742, because Pull request dart-lang/webdev/2742 is not in a mergeable state.

class DevToolsRequest {
/// Identifies a given application, across tabs/windows.
String get appId;
final String? appId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do these need to be non-nullable?

}

@override
int get hashCode =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't the greatest way to calculate a hash code. Consider using Object.hash(...) instead.


@override
int get hashCode =>
success.hashCode ^ promptExtension.hashCode ^ error.hashCode;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

}

static Object? _deserialize(dynamic decoded) {
if (decoded is List &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can use object destructuring:

if (decoded case ['DevToolsRequest', final Map<String, Object?> request]) {
  return DevToolsRequest.fromJson(request);
}

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 DevtoolsRequest/DevtoolsResponse

2 participants