writeJson static method

Future<void> writeJson(
  1. String path,
  2. Map<String, dynamic> jsonMap
)

将JSON格式的数据写入文件。

Implementation

static Future<void> writeJson(
    String path, Map<String, dynamic> jsonMap) async {
  File file = File(path);
  String jsonString = json.encode(jsonMap);
  await file.writeAsString(jsonString);
}