appendLine static method

Future<void> appendLine(
  1. String path,
  2. String line
)

向文件追加一行内容。

Implementation

static Future<void> appendLine(String path, String line) async {
  File file = File(path);
  IOSink sink = file.openWrite(mode: FileMode.append);
  sink.writeln(line);
  await sink.flush();
  await sink.close();
}