Flutter 在项目中查找由Dart.io和getApplicationDocumentsDirectory生成的文件

Flutter 在项目中查找由Dart.io和getApplicationDocumentsDirectory生成的文件,flutter,dart,Flutter,Dart,我有一个flatter项目,在这个项目中,我使用path_提供程序插件生成appData文件应该存储的目录 插件的工作原理是正确地生成c目录文件路径,但一旦文件被写入和读取,我就无法在我的项目结构中查看文件,以准确地查看写入的内容。有没有办法查看我使用Dart.IO写入的文件 import 'package:path_provider/path_provider.dart'; class AppDataService { Future<String> get _appData

我有一个flatter项目,在这个项目中,我使用path_提供程序插件生成appData文件应该存储的目录

插件的工作原理是正确地生成c目录文件路径,但一旦文件被写入和读取,我就无法在我的项目结构中查看文件,以准确地查看写入的内容。有没有办法查看我使用Dart.IO写入的文件

import 'package:path_provider/path_provider.dart';

class AppDataService {

  Future<String> get _appDataLocalPath async {
    final directory = await getApplicationDocumentsDirectory();
    return directory.path;
  }

  Future<File> get appDataFile async {
    final path = await _appDataLocalPath;
    log("Path: " + path);
    return File('$path/appData.json');
  }

  Future<void> write() async {
    final file = await appDataFile;

    file.writeAsString("Test write");
    var out = await file.readAsString();
    log("Written: " + out);
  }

} 
import'package:path_provider/path_provider.dart';
类AppDataService{
Future get\u appDataLocalPath异步{
最终目录=等待getApplicationDocumentsDirectory();
返回directory.path;
}
未来获取appDataFile异步{
最终路径=等待appDataLocalPath;
日志(“路径:“+Path”);
返回文件(“$path/appData.json”);
}
Future write()异步{
最终文件=等待appDataFile;
writeAsString(“测试写入”);
var out=await file.readAsString();
日志(“写入:“+out”);
}
} 

否,该文件是在测试设备的存储器中创建的,而不是在项目文件夹中创建的。您可以使用
dart:io
读取文件,并将其显示在应用程序中,或者您需要在测试设备的文档中查看该文件

提示 如果您使用的是iOS模拟器或Android模拟器,这些设备将存储在您的计算机上,因此这些设备的文档也将存储在您的计算机上

e、 g:存储在MacOS上运行的iPhone 6S模拟器上的文件

要获取文件路径,请尝试以下操作:

final file = await appDataFile;

//Click on it when it is printed in the output window.
print("file://${file.path}");
final file = await appDataFile;

//Click on it when it is printed in the output window.
print("file://${file.path}");