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

supabase / supabase-flutter / 23554637007
81%

Build:
DEFAULT BRANCH: main
Ran 25 Mar 2026 05:31PM UTC
Jobs 1
Files 70
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

25 Mar 2026 05:24PM UTC coverage: 81.084% (+0.7%) from 80.398%
23554637007

push

github

web-flow
fix(realtime): prevent null check crash in connect() during rapid lifecycle transitions (#1321)

* fix(realtime): prevent null check crash in connect() during rapid lifecycle transitions

Capture the WebSocketChannel in a local variable before awaiting ready,
then add a staleness guard (conn != localConn) after the await to bail
out if disconnect() ran concurrently. This prevents the TypeError when
conn is nullified between the await and the stream.listen() call.

Also replace the conn!.sink.done access in onResumed() with a stored
_disconnectFuture to eliminate a second NPE risk during lifecycle
flapping.

Fixes #1320

* style(realtime): use explicit type for localConn variable

* fix(realtime): add staleness guard in catch block and check connState in post-await guard

Address review feedback:
- Add conn != localConn guard inside the catch block to avoid firing
  error handlers for a stale connection attempt.
- Strengthen the post-await guard to also check connState == connecting,
  preventing connect() from proceeding if disconnect() has already set
  connState to disconnecting but hasn't yet nulled conn.

* style(realtime): fix formatting in channel_test.dart for 80-char line limit

* fix(supabase_flutter): clear _disconnectFuture after completion instead of eagerly

Address review feedback from icnahom: if a second resumed event fires
while disconnect is still in progress (e.g. paused → resumed → inactive
→ resumed), the eagerly-nulled _disconnectFuture causes the second
resumed to fall into the else branch where connect() no-ops because
conn is still non-null.

Move _disconnectFuture = null into the .then() callback with a guard to
avoid overwriting a newer future set by a subsequent paused event.

* test(supabase_flutter): add lifecycle reconnection tests

Add transport field to RealtimeClientOptions (non-breaking, additive)
so tests can inject a mock WebSocket transport. Add two lifecycle tests:
- paused → resumed reconnects after disconnect c... (continued)

17 of 22 new or added lines in 3 files covered. (77.27%)

3425 of 4224 relevant lines covered (81.08%)

2.75 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
5
87.01
26.49% packages/supabase_flutter/lib/src/supabase.dart
Jobs
ID Job ID Ran Files Coverage
1 23554637007.1 25 Mar 2026 05:31PM UTC 70
81.08
GitHub Action Run
Source Files on build 23554637007
  • Tree
  • List 70
  • Changed 5
  • Source Changed 4
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23554637007
  • 61f7cd1c on github
  • Prev Build on main (#23544809443)
  • Next Build on main (#23586063651)
  • 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