|
|
@@ -4,6 +4,8 @@ import 'dart:math';
|
|
|
import 'package:convert/convert.dart';
|
|
|
import 'package:crypto/crypto.dart';
|
|
|
import 'package:path/path.dart' as path;
|
|
|
+import 'package:file_selector/file_selector.dart' as file_selector;
|
|
|
+import 'package:path_provider/path_provider.dart';
|
|
|
import 'logger.dart';
|
|
|
|
|
|
|
|
|
@@ -104,3 +106,22 @@ deleteDirectory(String path) async {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+Future<String?> getSaveLocation({String? suggestedName}) async {
|
|
|
+ if (Platform.isIOS) {
|
|
|
+ final directory = await getApplicationDocumentsDirectory();
|
|
|
+
|
|
|
+ Log.d('iOS get file path: ${directory.path}/$suggestedName');
|
|
|
+
|
|
|
+ return '${directory.path}/$suggestedName';
|
|
|
+
|
|
|
+ } else {
|
|
|
+ final file_selector.FileSaveLocation? selectedFile = await file_selector.getSaveLocation(
|
|
|
+ suggestedName: suggestedName,
|
|
|
+ );
|
|
|
+ if (selectedFile != null) {
|
|
|
+ return selectedFile.path;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+}
|