1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00
Files
immich/mobile/lib/infrastructure/repositories/storage.repository.dart

24 lines
623 B
Dart
Raw Permalink Normal View History

import 'dart:io';
import 'package:logging/logging.dart';
import 'package:photo_manager/photo_manager.dart';
class StorageRepository {
const StorageRepository();
Future<File?> getFileForAsset(String assetId) async {
final log = Logger('StorageRepository');
File? file;
try {
final entity = await AssetEntity.fromId(assetId);
file = await entity?.originFile;
if (file == null) {
log.warning("Cannot get file for asset $assetId");
}
} catch (error, stackTrace) {
log.warning("Error getting file for asset $assetId", error, stackTrace);
}
return file;
}
}