mirror of
https://github.com/asjqkkkk/flutter-todos.git
synced 2025-08-06 14:19:24 +08:00
28 lines
655 B
Dart
28 lines
655 B
Dart
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:path/path.dart' as p;
|
|
|
|
|
|
|
|
//图片缓存管理类,目前没有用到
|
|
class CustomCacheManager extends CacheManager {
|
|
static const key = "customCache";
|
|
|
|
static CustomCacheManager _instance;
|
|
|
|
factory CustomCacheManager() {
|
|
if (_instance == null) {
|
|
_instance = new CustomCacheManager._();
|
|
}
|
|
return _instance;
|
|
}
|
|
|
|
CustomCacheManager._() : super(Config(key));
|
|
|
|
Future<String> getFilePath() async {
|
|
var directory = await getTemporaryDirectory();
|
|
return p.join(directory.path, key);
|
|
}
|
|
|
|
} |