updateBucket method

Future<String> updateBucket(
  1. String id,
  2. BucketOptions bucketOptions
)
inherited

Updates a new Storage bucket

id is a unique identifier for the bucket you are creating.

bucketOptions is a parameter to set the publicity of the bucket.

Implementation

Future<String> updateBucket(
  String id,
  BucketOptions bucketOptions,
) async {
  final FetchOptions options = FetchOptions(headers: headers);
  final response = await storageFetch.put(
    '$url/bucket/$id',
    {
      'id': id,
      'name': id,
      'public': bucketOptions.public,
      if (bucketOptions.fileSizeLimit != null)
        'file_size_limit': bucketOptions.fileSizeLimit,
      if (bucketOptions.allowedMimeTypes != null)
        'allowed_mime_types': bucketOptions.allowedMimeTypes,
    },
    options: options,
  );
  final message = (response as Map<String, dynamic>)['message'] as String;
  return message;
}