emptyBucket method
Removes all objects inside a single bucket.
id
The unique identifier of the bucket you would like to empty.
Implementation
Future<StorageResponse<String>> emptyBucket(String id) async {
try {
final FetchOptions options = FetchOptions(headers: headers);
final response =
await fetch.post('$url/bucket/$id/empty', {}, options: options);
if (response.hasError) {
return StorageResponse(error: response.error);
} else {
return StorageResponse<String>(
data: response.data['message'] as String,
);
}
} catch (e) {
return StorageResponse(error: StorageError(e.toString()));
}
}