diff --git a/lib/src/kdbx_object.dart b/lib/src/kdbx_object.dart index 1c858a9..52197a9 100644 --- a/lib/src/kdbx_object.dart +++ b/lib/src/kdbx_object.dart @@ -37,6 +37,10 @@ mixin Changeable { set isDirty(bool dirty) { // _logger.finest('changing dirty (old:$_isDirty) $dirty'); + if (!_isDirty && !dirty) { + // no need for change events when already not-dirty. + return; + } _isDirty = dirty; _controller.add(ChangeEvent(object: this as T, isDirty: dirty)); } @@ -64,7 +68,7 @@ abstract class KdbxNode with Changeable { /// will mark this object as not dirty. @mustCallSuper XmlElement toXml() { - _isDirty = false; + isDirty = false; final el = node.copy() as XmlElement; return el; }