I'm looking to apply a filter to a stream from Supabase but can't find any example of how to achieve this. Here is my function (without a filter):

Stream<List<Map<String, dynamic>>> _getProducts() {
   final response = supabase.from('products').stream().execute();
   return response;
}

I would like to apply a simple 'eq' filter to the stream. This is how it would look as a future:

Future<PostgrestResponse> _getProducts() async {
   final user = supabase.auth.currentUser;
   final response =
       await supabase.from('products').select().eq('uuid', user!.id).execute();
   return response;
 }

Unfortunately applying the same 'select().eq()' logic doesn't work.

Thanks.


Solution 1: Jaspreet Singh

this should work for you.

Future<List<Map<String, dynamic>>> _getProducts() async {    
final user = supabase.auth.currentUser;    
final response = await 
supabase.from('products:uuid=eq.${user!.id}').stream(['uuid']).execute();   
return response;  
}