refactor(realtime_client): extract broadcast headers and body builders#1461
Merged
Conversation
httpSend() and the REST fallback in send() built identical broadcast request headers and near-identical message bodies. Extract them into the _broadcastHeaders getter and _broadcastBody helper.
These ignores are flagged as unused by the DCM version used in CI, since that version no longer reports the assertions as unnecessary. Removing them unblocks the DCM check (pre-existing failure on main).
grdsdev
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
httpSend()and the REST fallback insidesend()built identical broadcast request headers and near-identical message bodies. This extracts the duplication into:Map<String, String> get _broadcastHeadersMap<String, dynamic> _broadcastBody(String? event, Map<String, dynamic> payload)Both call sites now use these helpers.
Notes
event/payload), which is irrelevant for JSON encoding.// ignore: avoid-inferrable-type-argumentscomments are no longer needed since the map literal type is now inferred from the getter's return type.Verification
dart analyze libanddcm analyzepass with no issues.Connection refused.)Note: This branch also includes a one-line removal of two stale
avoid-unnecessary-type-assertionsignores inpostgrest_builder.dart. They are flagged as unused by the DCM version used in CI (a pre-existing failure onmain, present on every PR). Including it here keeps this PR's pipeline green; it can drop out cleanly once another PR carrying the same fix lands.