Skip to content

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

feat: updated storage docs with dart v1.0-dev

dshukertjr4a3c738f6a3c
diff --git a/apps/reference/_supabase_dart/generated/storage-createbucket.mdx b/apps/reference/_supabase_dart/generated/storage-createbucket.mdx
index dd3ba519532..7abae13d89b 100644
--- a/apps/reference/_supabase_dart/generated/storage-createbucket.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-createbucket.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Creates a new Storage bucket
```dart
-final res = await supabase
+final String bucketId = await supabase
.storage
.createBucket('avatars');
```
@@ -27,7 +27,7 @@ final res = await supabase
### Create bucket
```dart
-final res = await supabase
+final String bucketId = await supabase
.storage
.createBucket('avatars');
```
diff --git a/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx b/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx
index d8466d3ddd6..c1867fdaac9 100644
--- a/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket.
```dart
-final res = await supabase
+final String result = await supabase
.storage
.deleteBucket('avatars');
```
@@ -27,7 +27,7 @@ final res = await supabase
### Delete bucket
```dart
-final res = await supabase
+final String result = await supabase
.storage
.deleteBucket('avatars');
```
diff --git a/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx b/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx
index 47372c505ee..3ebe3d0481e 100644
--- a/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Removes all objects inside a single bucket.
```dart
-final res = await supabase
+final String result = await supabase
.storage
.emptyBucket('avatars');
```
@@ -27,7 +27,7 @@ final res = await supabase
### Empty bucket
```dart
-final res = await supabase
+final String result = await supabase
.storage
.emptyBucket('avatars');
```
diff --git a/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx
index e4c4ea26957..0b6691979d5 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx
@@ -11,12 +11,10 @@ import TabItem from '@theme/TabItem'
Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.
```dart
-final res = await supabase
+final String signedUrl = await supabase
.storage
.from('avatars')
.createSignedUrl('avatar1.png', 60);
-
-final signedURL = res.data;
```
## Notes
@@ -30,10 +28,8 @@ final signedURL = res.data;
### Create Signed URL
```dart
-final res = await supabase
+final String signedUrl = await supabase
.storage
.from('avatars')
.createSignedUrl('avatar1.png', 60);
-
-final signedURL = res.data;
```
diff --git a/apps/reference/_supabase_dart/generated/storage-from-download.mdx b/apps/reference/_supabase_dart/generated/storage-from-download.mdx
index 44c80600d91..5b205e0bb08 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-download.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-download.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Downloads a file.
```dart
-final res = await supabase
+final Uint8List file = await supabase
.storage
.from('avatars')
.download('avatar1.png');
@@ -28,7 +28,7 @@ final res = await supabase
### Download file
```dart
-final res = await supabase
+final Uint8List file = await supabase
.storage
.from('avatars')
.download('avatar1.png');
diff --git a/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx
index 44cfa40072c..18853e773ac 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx
@@ -11,12 +11,10 @@ import TabItem from '@theme/TabItem'
Retrieve URLs for assets in public buckets
```dart
-final res = supabase
+final String publicUrl = supabase
.storage
.from('public-bucket')
.getPublicUrl('avatar1.png');
-
-final publicURL = res.data;
```
## Notes
@@ -31,10 +29,8 @@ final publicURL = res.data;
### Returns the URL for an asset in a public bucket
```dart
-final res = supabase
+final String publicUrl = supabase
.storage
.from('public-bucket')
.getPublicUrl('avatar1.png');
-
-final publicURL = res.data;
```
diff --git a/apps/reference/_supabase_dart/generated/storage-from-list.mdx b/apps/reference/_supabase_dart/generated/storage-from-list.mdx
index d760e8b757f..b19550f4eab 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-list.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-list.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Lists all the files within a bucket.
```dart
-final res = await supabase
+final List<FileObject> objects = await supabase
.storage
.from('avatars')
.list();
@@ -28,7 +28,7 @@ final res = await supabase
### List files in a bucket
```dart
-final res = await supabase
+final List<FileObject> objects = await supabase
.storage
.from('avatars')
.list();
diff --git a/apps/reference/_supabase_dart/generated/storage-from-move.mdx b/apps/reference/_supabase_dart/generated/storage-from-move.mdx
index 0a0462da7ed..ea147d37463 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-move.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-move.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Moves an existing file, optionally renaming it at the same time.
```dart
-final res = await supabase
+final String result = await supabase
.storage
.from('avatars')
.move('public/avatar1.png', 'private/avatar2.png');
@@ -28,7 +28,7 @@ final res = await supabase
### Move file
```dart
-final res = await supabase
+final String result = await supabase
.storage
.from('avatars')
.move('public/avatar1.png', 'private/avatar2.png');
diff --git a/apps/reference/_supabase_dart/generated/storage-from-remove.mdx b/apps/reference/_supabase_dart/generated/storage-from-remove.mdx
index 4267ab63d0e..a15ccbd2938 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-remove.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-remove.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Deletes files within the same bucket
```dart
-final res = await supabase
+final List<FileObject> objects = await supabase
.storage
.from('avatars')
.remove(['avatar1.png']);
@@ -28,7 +28,7 @@ final res = await supabase
### Delete file
```dart
-final res = await supabase
+final List<FileObject> objects = await supabase
.storage
.from('avatars')
.remove(['avatar1.png']);
diff --git a/apps/reference/_supabase_dart/generated/storage-from-update.mdx b/apps/reference/_supabase_dart/generated/storage-from-update.mdx
index 03dac7904f4..51946d2b8af 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-update.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-update.mdx
@@ -11,14 +11,13 @@ import TabItem from '@theme/TabItem'
Replaces an existing file at the specified path with a new one.
```dart
-final avatarFile = File('path/to/file');
-final res = await supabase
- .storage
- .from('avatars')
- .update('public/avatar1.png', avatarFile, fileOptions: FileOptions(
- cacheControl: '3600',
- upsert: false
- ));
+final avatarFile = File('path/to/local/file');
+final String path = await supabase.storage.from('avatars').update(
+ 'public/avatar1.png',
+ avatarFile,
+ fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
+ );
+
```
## Notes
@@ -32,12 +31,10 @@ final res = await supabase
### Update file
```dart
-final avatarFile = File('path/to/file');
-final res = await supabase
- .storage
- .from('avatars')
- .update('public/avatar1.png', avatarFile, fileOptions: FileOptions(
- cacheControl: '3600',
- upsert: false
- ));
+final avatarFile = File('path/to/local/file');
+final String path = await supabase.storage.from('avatars').update(
+ 'public/avatar1.png',
+ avatarFile,
+ fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
+ );
```
diff --git a/apps/reference/_supabase_dart/generated/storage-from-upload.mdx b/apps/reference/_supabase_dart/generated/storage-from-upload.mdx
index f9454c41893..8f6f8fd6717 100644
--- a/apps/reference/_supabase_dart/generated/storage-from-upload.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-from-upload.mdx
@@ -12,13 +12,11 @@ Uploads a file to an existing bucket.
```dart
final avatarFile = File('path/to/file');
-final res = await supabase
- .storage
- .from('avatars')
- .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions(
- cacheControl: '3600',
- upsert: false
- ));
+final String path = await supabase.storage.from('avatars').upload(
+ 'public/avatar1.png',
+ avatarFile,
+ fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
+ );
```
## Parameters
@@ -54,7 +52,7 @@ The relative file path. Should be of the format `folder/subfolder/filename.png`.
required
</span>
<span className="method-list-item-validation">
- <code>ArrayBuffer</code> | <code>ArrayBufferView</code> | <code>Blob</code> | <code>Buffer</code> | <code>File</code> | <code>FormData</code> | <code>ReadableStream</code> | <code>ReadableStream</code> | <code>URLSearchParams</code> | <code>string</code>
+ <code>File</code>
</span>
</h4>
<div class="method-list-item-description">
@@ -80,8 +78,8 @@ The body of the file to be stored in the bucket.
<div class="method-list-item-description">
HTTP headers.
-`cacheControl`: string, the `Cache-Control: max-age=<seconds>` seconds value.
-`contentType`: string, the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
+`cacheControl`: string, the `Cache-Control: max-age=<seconds>` seconds value. <br />
+`contentType`: string, the `Content-Type` header value. The SDK will read the content type and set the header for you by default.<br />
`upsert`: boolean, whether to perform an upsert.
</div>
@@ -102,11 +100,9 @@ HTTP headers.
```dart
final avatarFile = File('path/to/file');
-final res = await supabase
- .storage
- .from('avatars')
- .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions(
- cacheControl: '3600',
- upsert: false
- ));
+final String path = await supabase.storage.from('avatars').upload(
+ 'public/avatar1.png',
+ avatarFile,
+ fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
+ );
```
diff --git a/apps/reference/_supabase_dart/generated/storage-getbucket.mdx b/apps/reference/_supabase_dart/generated/storage-getbucket.mdx
index bc086060252..a6166dc199c 100644
--- a/apps/reference/_supabase_dart/generated/storage-getbucket.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-getbucket.mdx
@@ -11,9 +11,9 @@ import TabItem from '@theme/TabItem'
Retrieves the details of an existing Storage bucket.
```dart
-final res = await supabase
+final Bucket bucket = await supabase
.storage
- .getBucket('avatars')
+ .getBucket('avatars');
```
## Parameters
@@ -53,7 +53,7 @@ The unique identifier of the bucket you would like to retrieve.
### Get bucket
```dart
-final res = await supabase
+final Bucket bucket = await supabase
.storage
- .getBucket('avatars')
+ .getBucket('avatars');
```
diff --git a/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx b/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx
index b51a7024740..ff7ea234122 100644
--- a/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx
@@ -11,9 +11,9 @@ import TabItem from '@theme/TabItem'
Retrieves the details of all Storage buckets within an existing product.
```dart
-final res = await supabase
+final List<Bucket> buckets = await supabase
.storage
- .listBuckets()
+ .listBuckets();
```
## Notes
@@ -27,7 +27,7 @@ final res = await supabase
### List buckets
```dart
-final res = await supabase
+final List<Bucket> buckets = await supabase
.storage
- .listBuckets()
+ .listBuckets();
```
diff --git a/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx b/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx
index 38809788af9..ac0e92585a8 100644
--- a/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx
+++ b/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx
@@ -13,7 +13,7 @@ Updates a new Storage bucket
```dart
final res = await supabase
.storage
- .updateBucket('avatars', { public: false });
+ .updateBucket('avatars', const BucketOptions(public: false));
```
## Notes
@@ -29,5 +29,5 @@ final res = await supabase
```dart
final res = await supabase
.storage
- .updateBucket('avatars', { public: false });
+ .updateBucket('avatars', const BucketOptions(public: false));
```