默认保存位置在哪里Flutter

时间:2018-07-08 16:42:06

标签: csv dart save flutter

当我编写此代码时:

onSubmit(){
if(csvname.isEmpty){
  print('type name');
}else {
  File csvFile = new File(csvname + ".csv");

  print('yesssss');
}
}

它甚至可以创建一个csv文件吗?

如果是,它将保存在哪里或如何查看?

Full Code / pastebin

1 个答案:

答案 0 :(得分:1)

它不会与您发布的代码一起保存,请参见this doc。这是有关如何写入本地文件的示例:

Future<String> get _localPath async { 
final directory = await getApplicationDocumentsDirectory(); 
return directory.path; 
} 
Future<File> get _localFile async { 
final path = await _localPath; return File('$path/counter.txt'); 
}

Future<File> writeCounter(int counter) async { 
final file = await _localFile; // Write the file return file.writeAsString('$counter'); 
}