"Supabase Realtime Presence Flutter: Who's Online Tutorial"

Supabase realtime presence flutter — track online users, read presenceState, handle sync/join/leave events and add a mobile heartbeat, with runnable Dart code.

With supabase realtime presence flutter apps can show who's online, power typing indicators, and build live lobbies — without polling your database into the ground. Presence is one of Supabase Realtime's three features, and it's the only one designed for ephemeral "who's here right now" state: no tables, no writes, no cleanup jobs. You join a channel, track yourself, and read everyone else's state in real time. This tutorial builds a complete online-users service for Flutter 3.x with supabase_flutter 2.18.x, including the mobile heartbeat pattern that keeps presence honest when apps background. Last updated: October 3, 2026 What you'll learn Presence vs broadcast vs postgres changes — which to use when Tracking online users with channel.track() Reading the online-users list with presenceState() Handling sync , join , and leave events Untracking cleanly when the user leaves The mobile heartbeat pattern for backgrounding Securing presence channels Supabase Realtime Presence Flutter: How Presence Works A presence channel is a named room. Each client that joins *tracks* a small JSON payload (user id, name, timestamp). The server keeps the authoritative set of who's tracked; every client can read the full set via presenceState() and gets sync / join / leave events as it changes. When a client disconnects — closed tab, killed app, lost network — the server drops its presence automatically. That's the whole magic: "online" is derived from live connections, not from a last_seen column someone forgot to update. Step 1 — Track Online Users with Supabase Realtime Presence Create a channel, subscribe, and track() yourself once the subscription is confirmed. Track only after subscribed — tracking earlier silently does nothing, the most common…

Explore