getAppDirectory static method
Implementation
static Future<Directory> getAppDirectory() async {
Directory? tempDir;
//web 居然isMacos为true
if (Platform.isIOS || Platform.isMacOS) {
tempDir = await getApplicationDocumentsDirectory();
} else {
tempDir = await getExternalStorageDirectory();
}
final String tempPath = '${tempDir?.path}/';
final Directory file = Directory(tempPath);
if (!file.existsSync()) {
file.createSync(recursive: true);
}
return file;
}