saveJson function

void saveJson(
  1. String filepath,
  2. dynamic json, {
  3. bool beautify = false,
})

Writes json in filepath, with the option to beautify the string.

Implementation

void saveJson(String filepath, dynamic json, {bool beautify = false}) {
  String str;
  if (json is! String) {
    str = beautify ? prettyJson(json) : jsonEncode(json);
  } else {
    str = json;
  }
  saveString(filepath, str);
}