downloadDirectory static method
Implementation
static Future<String?> downloadDirectory(String folderName) async {
if (kIsWeb) {
return null;
}
try {
const basePath = '/storage/emulated/0/Download';
final path = '$basePath/$folderName';
final dir = Directory(path);
if (!await dir.exists()) {
await dir.create(recursive: true);
}
return dir.path;
} catch (error) {
try {
final fallback = await getExternalStorageDirectory();
return fallback?.path;
} catch (_) {
return null;
}
}
}