Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: add proper conditional filter example on Flutter docs

dshukertjra15443194af5
diff --git a/spec/supabase_dart_v1.yml b/spec/supabase_dart_v1.yml
index 46bf3067102..70a69f18086 100644
--- a/spec/supabase_dart_v1.yml
+++ b/spec/supabase_dart_v1.yml
@@ -1768,13 +1768,22 @@ functions:
- id: conditional-chaining
name: Conditional Chaining
description: |
- Filters can be built up one step at a time and then executed. For example:
+ Filters can be built up one step at a time and then executed as shown in the example code.
code: |
```dart
- final data = await supabase
- .from('users')
- .select()
- .eq('address->postcode', 90210);
+ final filterByName = null;
+ final filterPopLow = 1000;
+ final filterPopHigh = 10000;
+
+ var query = supabase
+ .from('cities')
+ .select('name, country_id');
+
+ if (filterByName != null) { query = query.eq('name', filterByName); }
+ if (filterPopLow != null) { query = query.gte('population', filterPopLow); }
+ if (filterPopHigh != null) { query = query.lt('population', filterPopHigh); }
+
+ final data = await query;
```
- id: filter-by-value-within-json-column
name: Filter by values within a JSON column