The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: update flutter v2 docs about count (#19805)
Tyler4b78ff58c2fa
diff --git a/apps/docs/docs/ref/dart/upgrade-guide.mdx b/apps/docs/docs/ref/dart/upgrade-guide.mdxindex 70cfa5bd823..2ecc588f7b9 100644--- a/apps/docs/docs/ref/dart/upgrade-guide.mdx+++ b/apps/docs/docs/ref/dart/upgrade-guide.mdx@@ -494,6 +494,76 @@ We have brought numerous updates behind the scenes to make the SDK work more int</RefSubLayout.Examples></RefSubLayout.EducationRow>+<RefSubLayout.EducationRow>+ <RefSubLayout.Details>++ #### Deprecate FetchOption in favor of `count()` and `head()` methods++ `FetchOption()` on `.select()` is now deprecated, and new `.count()` and `head()` methods are added to the query builder.++ `count()` on `.select()` performs the select while also getting the count value, and `.count()` directly on `.from()` performs a head request resulting in only fetching the count value.++ </RefSubLayout.Details>+ <RefSubLayout.Examples>++ <Tabs+ scrollable+ size="small"+ type="underlined"+ defaultActiveId="1.0x"+ queryGroup="version"+ >+ <TabPanel id="1.0x" label="Before">+ ```dart+ // Request with count option+ final res = await supabase.from('cities').select(+ 'name',+ const FetchOptions(+ count: CountOption.exact,+ ),+ );++ final data = res.data;+ final count = res.count;++ // Request with count and head option+ // obtains the count value without fetching the data.+ final res = await supabase.from('cities').select(+ 'name',+ const FetchOptions(+ count: CountOption.exact,+ head: true,+ ),+ );++ final count = res.count;+ ```++ </TabPanel>+ <TabPanel id="2.0x" label="After">+ ```dart+ // Request with count option+ final res = await supabase+ .from('cities')+ .select('name')+ .count(); // CountOption.exact is the default value++ final data = res.data;+ final int count = res.count;++ // `.count()` directly on `.from()` performs a head request,+ // obtaining the count value without fetching the data.+ final int count = await supabase+ .from('cities')+ .count(); // CountOption.exact is the default value+ ```++ </TabPanel>+ </Tabs>++ </RefSubLayout.Examples>+</RefSubLayout.EducationRow>+<RefSubLayout.EducationRow><RefSubLayout.Details>diff --git a/spec/supabase_dart_v2.yml b/spec/supabase_dart_v2.ymlindex 923484c98fe..cb5152b4315 100644--- a/spec/supabase_dart_v2.yml+++ b/spec/supabase_dart_v2.yml@@ -918,16 +918,15 @@ functions:name: Querying with count optiondescription: |You can get the number of rows by using the count option.- Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count).+ Allowed values for count option are [CountOption.exact](https://postgrest.org/en/stable/api.html#exact-count), [CountOptionplanned](https://postgrest.org/en/stable/api.html#planned-count) and [CountOption.estimated](https://postgrest.org/en/stable/api.html#estimated-count).code: |```dart- final res = await supabase.from('cities').select(- 'name',- const FetchOptions(- count: CountOption.exact,- ),- );+ final res = await supabase+ .from('cities')+ .select('name')+ .count(CountOption.exact);+ final data = res.data;final count = res.count;```- id: querying-json-data@@ -1075,13 +1074,14 @@ functions:- id: return-the-exact-number-of-rowsname: Return the exact number of rowsdescription: |- Allowed values for count option are `exact`, `planned` and `estimated`.+ Allowed values for count option are `CountOption.exact`, `CountOption.planned` and `CountOption.estimated`.code: |```dart- final res = await supabase.from('users').upsert(- {'id': 3, 'message': 'foo', 'username': 'supabot'},- options: const FetchOptions(count: CountOption.exact),- );+ final res = await supabase.from('users').upsert({+ 'id': 3,+ 'message': 'foo',+ 'username': 'supabot'+ }).count(CountOption.exact);final data = res.data;final count = res.count;