创建一个文件

1817次阅读  |  发布于5年以前

创建一个文件

Use the File create() method to create a file. To create intermediate directories, set the recursive argument to true (default is false).

import 'dart:io';

main() async {
  // Get the system temp directory.
  var systemTempDir = Directory.systemTemp;
  // Creates dir/, dir/subdir/, and dir/subdir/file.txt in the system
  // temp directory.
  var file = await new File('${systemTempDir.path}/dir/subdir/file.txt')
      .create(recursive: true);
  print(file.path);
}

Copyright© 2013-2019

京ICP备2023019179号-2