• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 28613300326
86%

Build:
DEFAULT BRANCH: main
Ran 02 Jul 2026 06:39PM UTC
Jobs 8
Files 81
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Jul 2026 06:37PM UTC coverage: 86.011%. Remained the same
28613300326

push

github

web-flow
fix(realtime): preserve nested empty maps in Message.toJson() (#1518)

## What

`Message.toJson()` flattens nested maps by assigning into
`processedPayload[outerKey]` from inside a loop over the inner map's
keys. When the nested value is an **empty** map, that loop body never
runs, so the outer key is never assigned and disappears from the
serialized payload:

```dart
Message(
  topic: 'room:lobby',
  event: ChannelEvents.presence,
  payload: {'event': 'track', 'payload': <String, dynamic>{}},
).toJson();
// {topic: room:lobby, event: presence, payload: {event: track}}
//                                                 ^ the nested `payload` key is gone
```

## Why

A presence `track({})` (tracking with no metadata) and any
broadcast/send whose payload contains a nested empty map are sent to the
Realtime server **missing their `payload` field**. The initialization
`processedPayload[outerKey] ??= {}` lived inside the inner `for` loop,
so it was skipped entirely for an empty map.

Fix: initialize `processedPayload[outerKey]` to an empty map **before**
the loop, so an empty map round-trips as `{}` instead of vanishing.

## Not a breaking change

Non-empty nested maps serialize exactly as before (the initialization
simply moved ahead of the loop). Only the previously-dropped empty-map
case changes — it's now preserved.

## Tests

Added to `packages/realtime_client/test/message_test.dart`: a nested
empty map (`track({})` shape) is preserved, and a nested non-empty map
still serializes correctly. The empty-map test fails on the current code
(`Actual: {'event': 'track'}`) and passes with the fix. `dart format`
and `dart analyze --fatal-warnings` are clean.

1 of 1 new or added line in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

4218 of 4904 relevant lines covered (86.01%)

4.0 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
87.5
0.0% packages/realtime_client/lib/src/message.dart
Jobs
ID Job ID Ran Files Coverage
6 supabase_flutter - 28613300326.6 02 Jul 2026 06:40PM UTC 11
79.57
GitHub Action Run
7 supabase - 28613300326.7 02 Jul 2026 06:39PM UTC 15
81.8
GitHub Action Run
8 realtime_client - 28613300326.8 02 Jul 2026 06:41PM UTC 11
89.15
GitHub Action Run
8 gotrue - 28536394514.8 01 Jul 2026 05:43PM UTC 27
84.74
GitHub Action Run
3 yet_another_json_isolate - 28433368938.3 30 Jun 2026 09:12AM UTC 1
79.03
GitHub Action Run
7 postgrest - 28603435609.7 02 Jul 2026 03:56PM UTC 9
84.31
GitHub Action Run
7 functions_client - 28444889808.7 30 Jun 2026 12:39PM UTC 2
98.57
GitHub Action Run
8 storage_client - 28533236058.8 01 Jul 2026 04:46PM UTC 5
92.98
GitHub Action Run
Source Files on build 28613300326
  • Tree
  • List 81
  • Changed 3
  • Source Changed 3
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #28613300326
  • 1777a225 on github
  • Prev Build on main (#28603435609)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc