upsertSync method
- T data
Implementation
K upsertSync(T data) {
final id = idGetterFunction(data);
final file = File('${directory.path}/$id.json');
final json = jsonEncode(toJsonFunction(data));
final encryptedJson = encriptionKey.isNotBlank ? json.applyXorEncrypt(encriptionKey) : json; // Encrypt the JSON if key is not blank
file.writeAsStringSync(encryptedJson);
return id;
}