Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-04 12:50:00 +02:00
parent 212f33ff51
commit 68b075f0b1
15 changed files with 1345 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
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<Uint8List> 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");
}
}
}