把字符串写到文件中

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

把字符串写到文件中

Use the File object’s writeAsString() method to write a string to a file. After writing the string, the method closes the file.

import 'dart:io';

main() async {
  final filename = 'file.txt';
  var file = await new File(filename).writeAsString('some content');
  print("Content written to $file");
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8