Listen to database changes
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.
stream()
will emit the initial data as well as any further change on the database asStream<List<Map<String, dynamic>>>
by combining Postgrest and Realtime.- Takes a list of primary key column names that will be used to update and delete the proper records within the SDK.
- The following filters are available
.eq('column', value)
listens to rows where the column equals the value.neq('column', value)
listens to rows where the column does not equal the value.gt('column', value)
listens to rows where the column is greater than the value.gte('column', value)
listens to rows where the column is greater than or equal to the value.lt('column', value)
listens to rows where the column is less than the value.lte('column', value)
listens to rows where the column is less than or equal to the value.inFilter('column', [val1, val2, val3])
listens to rows where the column is one of the values
supabase.from('countries')
.stream(primaryKey: ['id'])
.listen((List<Map<String, dynamic>> data) {
// Do something awesome with the data
});