.filter()

Finds all rows whose column satisfies the filter.

1final data = await supabase
2  .from('cities')
3  .select('name, country_id')
4  .filter('name', 'in', '("Paris","Tokyo")');

Notes#

  • .filter() expects you to use the raw PostgREST syntax for the filter names and values, so it should only be used as an escape hatch in case other filters don't work.
    1  .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} and 'cs' for contains.
    2  .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column.
    3  .filter('id','in','(6,7)')  // Use Postgres list () and 'in' for in_ filter.
    4  .filter('id','cs','{${mylist.join(',')}}')  // You can insert a Dart array list.

Examples#

With select()#

1final data = await supabase
2  .from('cities')
3  .select('name, country_id')
4  .filter('name', 'in', '("Paris","Tokyo")');

With update()#

1final data = await supabase
2  .from('cities')
3  .update({ 'name': 'Mordor' })
4  .filter('name', 'in', '("Paris","Tokyo")');

With delete()#

1final data = await supabase
2  .from('cities')
3  .delete()
4  .filter('name', 'in', '("Paris","Tokyo")');

With rpc()#

1// Only valid if the Stored Procedure returns a table type.
2final data = await supabase
3  .rpc('echo_all_cities')
4  .filter('name', 'in', '("Paris","Tokyo")');

Filter embedded resources#

1final data = await supabase
2  .from('cities')
3  .select('name, countries ( name )')
4  .filter('countries.name', 'in', '("France","Japan")');