mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-19 15:45:26 +02:00
improved caching
This commit is contained in:
parent
120685ed2c
commit
f5fd31d592
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user