Menu

1 / 2

Supabase Realtime with Flutter — Postgres Changes, Presence, and Broadcast in Practice

DEV Community·kanta13jp1·6 months ago
#Dl79Yaog
#supabase#flutter#webdev#programming#string
Reading 0:00
15s threshold

Supabase Realtime streams PostgreSQL changes to clients over WebSocket. Combine it with Flutter and you can ship live notifications, "who's online" indicators, and collaborative editing in dozens of lines of code. This guide covers all three channel types — Postgres Changes, Presence, and Broadcast — with production-ready examples.

The Three Channel Types

Type Use Case Data Source

Postgres Changes React to INSERT/UPDATE/DELETE PostgreSQL WAL

Broadcast Client-to-client events Realtime server

Presence "Who's online" state sync Realtime server

Setup

# pubspec.yaml dependencies : supabase_flutter : ^2.5.0

Enter fullscreen mode

Exit fullscreen mode

// main.dart import 'package:supabase_flutter/supabase_flutter.dart' ;

void main () async { await Supabase . initialize ( url: 'https://<project>.supabase.co' , anonKey: '<anon-key>' , realtimeClientOptions: const RealtimeClientOptions ( eventsPerSecond: 10 , logLevel: RealtimeLogLevel . info , ), ); runApp ( const App ()); }

final supabase = Supabase .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.