Skip to content

Conversation

@jyameo
Copy link
Contributor

@jyameo jyameo commented Jan 7, 2026

DebugInfo:

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

Changes

  • Rewrote DebugInfo as a simple Dart class with manual JSON serialization
  • Removed DebugInfo from the @SerializersFor annotation in serializers.dart
  • Updated client.dart to use named parameters and toJson() for serialization instead of the builder pattern
  • Updated debug extension files to handle DebugInfo serialization/deserialization:
    • background.dart: Changed from builder pattern to named constructor
    • detector.dart: Changed from serializers.deserialize to DebugInfo.fromJson()
    • debug_info.dart: Updated to use named constructor and toJson()
    • messaging.dart: Added special handling for DebugInfo in interceptMessage<T>()
    • storage.dart: Added special handling for DebugInfo in storage operations
  • Removed generated file debug_info.g.dart

Testing

  • Existing tests for debug info and extension functionality continue to pass with the updated implementation
  • Follows the same pattern used for ConnectRequest, HotReloadRequest, HotReloadResponse, HotRestartRequest, HotRestartResponse, ServiceExtensionRequest, and ServiceExtensionResponse

Fixes dart-lang/sdk#62295

extensionUrl: windowContext['\$dartExtensionUri'] as String?,
isInternalBuild: windowContext['\$isInternalBuild'] as bool?,
isFlutterApp: windowContext['\$isFlutterApp'] as bool?,
).toJson(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to call .toJson() on the value passed t jsonEncode()? I'm not super familiar with the best practices here so maybe this is normal but it seems unnecessary based on the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right! Calling .toJson() before passing to jsonEncode() is redundant. Thanks

final json = value is String
? value
: value is DebugInfo
? jsonEncode(value.toJson())
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

isInternalBuild: windowContext.$isInternalBuild,
isFlutterApp: windowContext.$isFlutterApp,
workspaceName: dartWorkspaceName,
).toJson(),
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@jyameo
Copy link
Contributor Author

jyameo commented Jan 8, 2026

Note: The callstack test failures are unrelated to this PR. They appear to be a regression in the current SDK dev release (3.11.0-260.0.dev) used by the bots, as they do not reproduce on the main branch.

@jyameo jyameo merged commit e30efe9 into dart-lang:main Jan 8, 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 DebugInfo

3 participants