dir static method
Returns an Images folder inside the platform cache directory.
Implementation
static Future<String> dir() async {
try {
final cacheDir = await getTemporaryDirectory();
final path = join(cacheDir.path, 'Images');
final dir = Directory(path);
if (!dir.existsSync()) {
dir.createSync(recursive: true);
}
return path;
} on MissingPluginException {
// Fallback for environments where path_provider isn't registered yet
if (!kIsWeb) {
final path = join(Directory.systemTemp.path, 'Images');
final dir = Directory(path);
if (!dir.existsSync()) {
dir.createSync(recursive: true);
}
return path;
}
// On web, return a virtual path; actual File operations may not be supported
return '/Images';
}
}