import 'dart:typed_data'; import 'package:supabase_flutter/supabase_flutter.dart'; class AttachmentsRepository { final _supabase = Supabase.instance.client; /// Scarica i byte di un file direttamente da Supabase Storage Future downloadAttachmentBytes(String storagePath) async { try { // ATTENZIONE: Sostituisci 'attachments' con il nome VERO del tuo bucket su Supabase! // Se il tuo storagePath contiene giĆ  il nome del bucket all'inizio, // assicurati di passargli solo il percorso interno. final Uint8List bytes = await _supabase.storage .from('attachments') // <--- NOME DEL TUO BUCKET .download(storagePath); return bytes; } catch (e) { throw Exception("Impossibile scaricare il documento dal cloud: $e"); } } }