improved caching

This commit is contained in:
Myzel394 2022-08-14 17:13:57 +02:00
parent 120685ed2c
commit f5fd31d592

View File

@ -63,13 +63,14 @@ class FileManager {
final location = memory['location']; final location = memory['location'];
final memoryType = final memoryType =
location.split('.').last == 'jpg' ? MemoryType.photo : MemoryType.video; location.split('.').last == 'jpg' ? MemoryType.photo : MemoryType.video;
final file = await supabase.storage.from('memories').download(location);
if (file.error != null) { try {
final file = await downloadFile('memories', location);
return [file, memoryType];
} catch (error) {
return null; return null;
} }
return [file.data!, memoryType];
} }
static Future<Uint8List> downloadFile( static Future<Uint8List> downloadFile(