stream method
Returns real-time data from your table as a Stream
.
Realtime is disabled by default for new tables. You can turn it on by managing replication.
Pass the list of primary key column names to primaryKey
, which will be used to updating and deleting the proper records internally as the library receives real-time updates.
supabase.from('chats').stream(primaryKey: ['id']).listen(_onChatsReceived);
eq
, neq
, lt
, lte
, gt
or gte
and order
, limit
filter are available to limit the data being queried.
supabase.from('chats').stream(primaryKey: ['id']).eq('room_id','123').order('created_at').limit(20).listen(_onChatsReceived);
Implementation
SupabaseStreamFilterBuilder stream({required List<String> primaryKey}) {
assert(primaryKey.isNotEmpty, 'Please specify primary key column(s).');
return SupabaseStreamFilterBuilder(
queryBuilder: this,
realtimeClient: _realtime,
realtimeTopic: '$_schema:$_table:$_incrementId',
schema: _schema,
table: _table,
primaryKey: primaryKey,
);
}