Skip to content

refactor(realtime_client): extract broadcast headers and body builders#1461

Merged
spydon merged 2 commits into
mainfrom
refactor/realtime-broadcast-http
Jun 24, 2026
Merged

refactor(realtime_client): extract broadcast headers and body builders#1461
spydon merged 2 commits into
mainfrom
refactor/realtime-broadcast-http

Conversation

@spydon

@spydon spydon commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What

httpSend() and the REST fallback inside send() built identical broadcast request headers and near-identical message bodies. This extracts the duplication into:

  • Map<String, String> get _broadcastHeaders
  • Map<String, dynamic> _broadcastBody(String? event, Map<String, dynamic> payload)

Both call sites now use these helpers.

Notes

  • No behavior change. The two body literals previously differed only in key order (event/payload), which is irrelevant for JSON encoding.
  • The // ignore: avoid-inferrable-type-arguments comments are no longer needed since the map literal type is now inferred from the getter's return type.

Verification

  • dart analyze lib and dcm analyze pass with no issues.
  • All realtime_client unit tests pass. (The integration test fails locally only because it needs a running realtime server: Connection refused.)

Note: This branch also includes a one-line removal of two stale avoid-unnecessary-type-assertions ignores in postgrest_builder.dart. They are flagged as unused by the DCM version used in CI (a pre-existing failure on main, 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.

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.
@spydon spydon requested a review from a team as a code owner June 24, 2026 09:46
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).
@spydon spydon closed this Jun 24, 2026
@spydon spydon reopened this Jun 24, 2026
@spydon spydon merged commit 7da7060 into main Jun 24, 2026
61 of 63 checks passed
@spydon spydon deleted the refactor/realtime-broadcast-http branch June 24, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants