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

1498次阅读  |  发布于4年以前

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

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);
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8