Build a Realtime Chat App with Flutter & Supabase (2026)

Build a complete realtime chat backend with Flutter and Supabase: rooms, membership RLS, realtime subscriptions with the v2 channels API, and presence β€” full working code.

A realtime chat is the fastest way to learn Supabase Realtime properly: it forces you to get the schema, the RLS policies, and the subscription lifecycle right β€” the three things every realtime feature needs. In this guide you'll build a complete chat backend (rooms, membership, messages, presence) plus the Flutter client that consumes it, using the current Realtime v2 channels API . The Dart code below was type-checked against the real supabase Dart package (v2.16.2, the core that supabase_flutter wraps). Run the SQL in your Supabase project's SQL editor, in order. What you'll build rooms , room_members , messages tables with RLS Realtime INSERT subscriptions scoped to one room Presence: who's online right now A Flutter ChatService with fetch, send, subscribe, and cleanup 🎬 Watch: Build a Real-Time Chat App Using Flutter & Supabase Dear Programmer builds the exact chat app from this guide β€” rooms, realtime messages, and presence β€” start to finish. Watch it alongside the code below. Step 1 β€” The schema create table rooms ( id uuid primary key default gen_random_uuid(), name text not null, created_by uuid not null references auth.users(id), created_at timestamptz not null default now() ); create table room_members ( room_id uuid not null references rooms(id) on delete cascade, user_id uuid not null references auth.users(id) on delete cascade, joined_at timestamptz not null default now(), primary key (room_id, user_id) ); create table messages ( id uuid primary key default gen_random_uuid(), room_id uuid not null references rooms(id) on delete cascade, user_id uuid not null references auth.users(id) on delete cascade, body text not null check (char_length(body) between 1 and 2000), created_at timestamptz not null default now() ); alter table rooms enable row level…

Explore