|
|
@@ -1,5 +1,6 @@
|
|
|
import 'dart:io' as io; // Используем префикс io
|
|
|
import 'dart:typed_data';
|
|
|
+import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
import 'package:path/path.dart' as p;
|
|
|
|
|
|
@@ -41,7 +42,16 @@ class DefaulFileManager {
|
|
|
|
|
|
if (await file.exists()) {
|
|
|
return file;
|
|
|
+ } else {
|
|
|
+ DefaultCacheManager defaultCacheManager = DefaultCacheManager();
|
|
|
+ FileInfo? file = await defaultCacheManager.getFileFromCache(key);
|
|
|
+ if (file != null) {
|
|
|
+ await saveFile(key: key, bytes: file.file.readAsBytesSync());
|
|
|
+ await defaultCacheManager.removeFile(key);
|
|
|
+ return file.file;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|