使用 dio get file 时获取文件位置

get file location when using dio get file

我正在尝试从我的网站下载一个 sqlite 文件,以便我的 Flutter 应用程序在应用程序中使用它。

我需要知道如何获取下载文件的路径。它们存放在哪里?如何获取该 sqlfile 所在位置的处理程序或路径字符串?

这是代码。

try {
  Response response = await Dio().get("https://mysqliteFile.sqlite");
  print('response is' + response.toString());

} catch (e) {
  print(e);
}

// Construct a file path to copy database to
Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, DBassistanceClass.databaseName);

谢谢

使用download方法将文件保存到指定路径

await dio.download("https://mysqliteFile.sqlite", path);