fetchStorageList function

Future<Storage?> fetchStorageList(
  1. String url,
  2. String apiKey, {
  3. Client? client,
})

Implementation

Future<Storage?> fetchStorageList(String url, String apiKey,
    {http.Client? client}) async {
  url = withScheme(url);
  try {
    // First attempt with API key
    final response = await supabaseGet('$url/storage/v1/bucket/',
        apiKey: apiKey, client: client);
    if (response.statusCode == 200) {
      return Storage.fromJson(jsonDecode(response.body));
    }
    print(
        "Failed to fetch Supabase storage information. Status code: ${response.statusCode}");
    print("Response body: ${response.body}");
  } catch (e) {
    print("Error fetching Supabase storage information: $e");
  }
  return null;
}