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");
}
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did129463