save method

Future<ConfigFile> save({
  1. bool compact = false,
})

Save the config data to the file.

Implementation

Future<ConfigFile> save({bool compact = false}) async {
  if (!file.existsSync()) file.createSync(recursive: true);
  if (compact) {
    await file.writeAsString(jsonEncode(data));
  } else {
    await file
        .writeAsString(const JsonEncoder.withIndent("  ").convert(data));
  }
  return this;
}