把文件内容读取到字符串变量中

把文件内容读取到字符串变量中

Use the File readAsString() method to read a file as a string.

import 'dart:io';

main() async {
  var contents = await new File('file.txt').readAsString();
  print(contents);
}

手机扫码阅读