You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
737 B

import 'dart:io';
import 'package:path_provider/path_provider.dart';
class ImgCachePath{
factory ImgCachePath() => _getInstance();
static ImgCachePath get instance => _getInstance();
static ImgCachePath? _instance;
String? _path;
String get path => _path ?? "";
ImgCachePath._internal(){
fileFromDocsDir();
}
fileFromDocsDir() async {
Directory tempDir = await getTemporaryDirectory();
Directory directory = new Directory('${tempDir.path}/ImgCache');
if (!directory.existsSync()) {
directory.createSync();
}
_path = directory.path;
}
static ImgCachePath _getInstance(){
if (_instance == null) {
_instance = ImgCachePath._internal();
}
return _instance!;
}
}