好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

把二进制内容写到文件中

Use the File writeAsBytes() method to write bytes to a file.

 import 'dart:io';
import 'dart:convert';

main() async {
  final string = 'Dart!';

  // Encode to UTF8.
  var encodedData = UTF8.encode(string);
  var file = await new File('file.txt');
  file.writeAsBytes(encodedData);
  var data = await file.readAsBytes();

  // Decode to a string, and print.
  print(UTF8.decode(data)); // Prints 'Dart!'.
} 

查看更多关于把二进制内容写到文件中的详细内容...

  阅读:68次

上一篇: 设置Flutter编辑器

下一篇:HTTP Get请求