2022-10-29 19:39:08 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
|
|
|
|
Future<Directory> getSavePath() async {
|
|
|
|
Directory dbpath;
|
|
|
|
if (defaultTargetPlatform == TargetPlatform.android ||
|
|
|
|
defaultTargetPlatform == TargetPlatform.iOS) {
|
2022-10-31 18:29:58 +00:00
|
|
|
final dir =
|
|
|
|
(await getExternalStorageDirectory())?.parent.parent.parent.parent ??
|
|
|
|
(await getApplicationDocumentsDirectory());
|
2022-10-29 20:55:38 +00:00
|
|
|
dbpath = Directory(
|
2022-10-31 18:29:58 +00:00
|
|
|
'${dir.path}${Platform.pathSeparator}Documents${Platform.pathSeparator}notes');
|
2022-10-29 19:39:08 +00:00
|
|
|
} else {
|
|
|
|
dbpath = Directory(
|
|
|
|
'${(await getApplicationDocumentsDirectory()).path}${Platform.pathSeparator}notes');
|
|
|
|
}
|
|
|
|
return dbpath;
|
|
|
|
}
|