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

supabase / supabase-flutter / 37468012283
92%

Build:
DEFAULT BRANCH: main
Ran 06 Oct 2026 01:06PM UTC
Jobs 11
Files 173
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

06 Oct 2026 01:04PM UTC coverage: 91.482% (+0.003%) from 91.479%
37468012283

push

github

web-flow
fix(supabase): sort null values in an ordered stream the way the database does (#1918)

## Summary

An ordered `stream()` stops sorting correctly as soon as one row holds
`null` in the order column.

```dart
supabase.from('todos').stream(primaryKey: ['id']).order('priority');

// fetched:  [{id: 1, priority: 1}, {id: 2, priority: null}]
// insert:   {id: 3, priority: 0}
// emitted:  [{id: 1, priority: 1}, {id: 2, priority: null}, {id: 3, priority: 0}]
```

`_sortData` compares two values only when both are numbers or both are
strings and answers `0` for every other pair, so `null` counts as equal
to every value. That is not an ordering (`0 == null`, `null == 1`, but
`0 < 1`), and `List.sort` needs one. Two things follow:

- A row arriving over realtime stops at the first `null` it meets
instead of moving to its place, as in the example above. With `limit()`
the wrong rows are then cut off.
- On a longer list the rows that hold no `null` come out in the wrong
order as well. With 100 sorted rows followed by three `null` rows, one
insert leaves `37` ahead of `36`.

The fix treats `null` as larger than any value, which is how PostgreSQL
orders it by default: last on an ascending sort, first on a descending
one. Since #1912 `order()` sends no null placement, so this is also the
order the fetch itself returns, and a row keeps its position between the
fetch, a realtime change and a refetch after a reconnect.

| Order | Before | After |
| -- | -- | -- |
| ascending | a `null` row stays where it arrived, later rows pile up
behind it | `null` rows last |
| descending | same | `null` rows first |

Only the comparison of a `null` with another value changes. Numbers and
strings compare as before, and so does every pair `_sortData` did not
order before, for example two booleans.

## Test

`packages/supabase/test/stream_order_test.dart`, on the same mocks as
`stream_insert_test.dart`:

- `an ascending order keeps null values last`. On `main`: `at location
[0]['id'] ... (continued)

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

9311 of 10178 relevant lines covered (91.48%)

5.18 hits per line

Jobs
ID Job ID Ran Files Coverage
3 iceberg - 37468012283.3 06 Oct 2026 01:06PM UTC 6
68.57
GitHub Action Run
4 supabase_storage - 37468012283.4 06 Oct 2026 01:09PM UTC 9
98.1
GitHub Action Run
5 supabase_auth - 37468012283.5 06 Oct 2026 01:09PM UTC 32
92.07
GitHub Action Run
6 supabase_functions - 37468012283.6 06 Oct 2026 01:06PM UTC 4
96.04
GitHub Action Run
7 supabase_realtime - 37468012283.7 06 Oct 2026 01:08PM UTC 13
90.67
GitHub Action Run
8 supabase_flutter - 37468012283.8 06 Oct 2026 01:06PM UTC 15
81.0
GitHub Action Run
9 supabase_typegen - 37468012283.9 06 Oct 2026 01:08PM UTC 24
96.19
GitHub Action Run
10 postgrest - 37468012283.10 06 Oct 2026 01:09PM UTC 29
93.55
GitHub Action Run
11 supabase - 37468012283.11 06 Oct 2026 01:09PM UTC 18
94.3
GitHub Action Run
6 supabase_common - 37446858483.6 06 Oct 2026 10:02AM UTC 22
87.55
GitHub Action Run
6 yet_another_json_isolate - 36864123641.6 01 Oct 2026 12:48PM UTC 1
98.44
GitHub Action Run
Source Files on build 37468012283
  • Tree
  • List 173
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #37468012283
  • 64dc4ec2 on github
  • Prev Build on main (#37467066164)
  • Next Build on main (#37468786125)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc