Browse Source

added support for renaming fields, deleting fields.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
5ccf14d349
  1. 13
      lib/src/kdbx_entry.dart

13
lib/src/kdbx_entry.dart

@ -117,13 +117,26 @@ class KdbxEntry extends KdbxObject {
StringValue getString(KdbxKey key) => _strings[key]; StringValue getString(KdbxKey key) => _strings[key];
void setString(KdbxKey key, StringValue value) { void setString(KdbxKey key, StringValue value) {
assert(key != null);
if (_strings[key] == value) { if (_strings[key] == value) {
_logger.finest('Value did not change for $key'); _logger.finest('Value did not change for $key');
return; return;
} }
isDirty = true; isDirty = true;
if (value == null) {
_strings.remove(key);
} else {
_strings[key] = value; _strings[key] = value;
} }
}
void renameKey(KdbxKey oldKey, KdbxKey newKey) {
final value = _strings[oldKey];
removeString(oldKey);
_strings[newKey] = value;
}
void removeString(KdbxKey key) => setString(key, null);
String _plainValue(KdbxKey key) { String _plainValue(KdbxKey key) {
final value = _strings[key]; final value = _strings[key];

Loading…
Cancel
Save