updateBucket method
Updates a new Storage bucket
id
A unique identifier for the bucket you are creating.
bucketOptions
A parameter to set the publicity of the bucket.
Implementation
Future<StorageResponse<String>> updateBucket(
String id,
BucketOptions bucketOptions,
) async {
try {
final FetchOptions options = FetchOptions(headers: headers);
final response = await fetch.put(
'$url/bucket/$id',
{'id': id, 'public': bucketOptions.public},
options: options,
);
if (response.hasError) {
return StorageResponse(error: response.error);
} else {
final message = response.data['message'] as String;
return StorageResponse<String>(data: message);
}
} catch (e) {
return StorageResponse(error: StorageError(e.toString()));
}
}