externalDocumentPath top-level property
Implementation
Future<String> get externalDocumentPath async {
Directory directory;
if (Platform.isIOS) {
directory = await getApplicationDocumentsDirectory(); // for iOS
} else {
directory = Directory('/storage/emulated/0/Download'); // for Android
if (!await directory.exists()) {
directory = (await getExternalStorageDirectory())!;
}
}
final exPath = directory.path;
debugPrint("PDF Saved Path: $exPath");
await Directory('$exPath/Petro SDK').create(recursive: true);
return exPath;
}