updateBucket method Null safety

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

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.


Future<StorageResponse<String>> updateBucket(
  String id,
  BucketOptions bucketOptions,
) async {
  try {
    final FetchOptions options = FetchOptions(headers: headers);
    final response = await fetch.put(
      {'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()));