SupabaseRemoteStore class

RemoteStore implementation using Supabase Postgrest.

Pushes records via .upsert() / .update() / .delete() and pulls via .select().gt('updated_at', since).

Smart Sync Gate

For the sync gate to work, your Supabase project needs a sync_status table with one row per user and a timestamptz column per synced table (e.g., users_at, tasks_at).

These columns should be maintained by Supabase triggers. If you don't have a sync_status table, getRemoteTimestamps returns an empty map and all tables will be pulled on every sync.

Implemented types

Constructors

SupabaseRemoteStore({required SupabaseClient client, required String userId(), String syncStatusTable = 'sync_status', Map<String, String> tableTimestampKeys = const {}})
Creates a Supabase remote store.
const

Properties

client → SupabaseClient
The Supabase client used for all remote operations.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
syncStatusTable → String
The name of the Supabase table that tracks per-user sync timestamps.
final
tableTimestampKeys → Map<String, String>
Maps synced table names to their corresponding timestamp column in syncStatusTable.
final
userId → String Function()
Returns the current user ID. Called per sync cycle to handle session expiry and account switches.
final

Methods

getRemoteTimestamps() → Future<Map<String, DateTime>>
Get the last-modified timestamp for each synced table from the remote.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pullSince(String table, DateTime since) → Future<List<Map<String, dynamic>>>
Pull all records from table updated after since.
override
push(String table, String id, SyncOperation operation, Map<String, dynamic> data) → Future<void>
Push a single record to the remote.
override
pushBatch(List<SyncEntry> entries) → Future<void>
Push multiple records to the remote in optimized batches.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited