Skip to content

chore: align package README names, harden headers getter, simplify forEach loops#1464

Merged
spydon merged 1 commit into
mainfrom
chore/cleanup-readmes-headers-foreach
Jun 25, 2026
Merged

chore: align package README names, harden headers getter, simplify forEach loops#1464
spydon merged 1 commit into
mainfrom
chore/cleanup-readmes-headers-foreach

Conversation

@spydon

@spydon spydon commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What

A small batch of cleanups in the same spirit as #1458 / the recent functions_client simplifications.

  • README headings: gotrue, realtime_client, storage_client, and supabase still used the old *-dart repo slugs in their first heading. Aligned them to the actual pub package name (matching the earlier functions-dartfunctions_client fix).
  • SupabaseClient.headers: was get headers { return _headers; }, returning the internal map directly. Now returns Map.unmodifiable(_headers) with arrow syntax, mirroring functions_client. This prevents callers from mutating the returned map and silently desyncing from the internal state (header changes must go through the headers= setter, which propagates to all sub-clients).
  • forEach closures → plain loops:
    • postgrest_filter_builder.match(): dropped the reassign-inside-closure query.forEach((k, v) => url = ...) for a for loop.
    • realtime_client transformers.convertChangeData: record.forEach((key, value) {...}) had an unused value parameter → for (final key in record.keys).

Why

Consistency across package READMEs, and closing a small footgun on the public headers getter so external mutation can't quietly diverge from what the sub-clients actually send.

Verification

  • dart format --set-exit-if-changed: clean
  • dart analyze lib on postgrest, realtime_client, supabase: no issues
  • Tests: supabase client_test (incl. Headers Management), utilities_test, mock_test, and realtime transformers_test pass. Pre-existing integration tests that require a local server are unaffected.

Note on the headers change

This is technically a behavior change on a public getter: external client.headers['x'] = y previously no-op'd (the mutation was lost) and now throws. The supported path to change headers remains the headers= setter.

…rEach loops

- Fix package README headings that still used the old `*-dart` repo slugs
  (gotrue, realtime_client, storage_client, supabase) to match the actual
  pub package name.
- Return an unmodifiable copy from SupabaseClient.headers and use arrow
  syntax, mirroring functions_client so external mutation cannot silently
  desync from the internal map.
- Replace forEach-with-closure loops with plain loops in
  postgrest_filter_builder.match (drops a closure reassignment) and
  realtime_client transformers (drops an unused value parameter).
@spydon spydon requested a review from a team as a code owner June 24, 2026 14:12
@spydon spydon merged commit ba67347 into main Jun 25, 2026
37 checks passed
@spydon spydon deleted the chore/cleanup-readmes-headers-foreach branch June 25, 2026 09:22
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