Browse Source

don't subscribe to children, because i want to be able to load in a background isolate.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
75186d3c02
  1. 42
      lib/src/kdbx_format.dart

42
lib/src/kdbx_format.dart

@ -35,10 +35,8 @@ class Credentials {
} }
} }
class KdbxFile with Changeable<KdbxFile> { class KdbxFile {
KdbxFile(this.credentials, this.header, this.body) { KdbxFile(this.credentials, this.header, this.body);
_subscribeToChildren();
}
static final protectedValues = Expando<ProtectedValue>(); static final protectedValues = Expando<ProtectedValue>();
@ -51,8 +49,6 @@ class KdbxFile with Changeable<KdbxFile> {
protectedValues[node] = value; protectedValues[node] = value;
} }
final StreamSubscriptions _subscriptions = StreamSubscriptions();
final Credentials credentials; final Credentials credentials;
final KdbxHeader header; final KdbxHeader header;
final KdbxBody body; final KdbxBody body;
@ -80,23 +76,23 @@ class KdbxFile with Changeable<KdbxFile> {
.cast<KdbxObject>() .cast<KdbxObject>()
.followedBy(body.rootGroup.getAllEntries()); .followedBy(body.rootGroup.getAllEntries());
void _subscribeToChildren() { // void _subscribeToChildren() {
final allObjects = _allObjects; // final allObjects = _allObjects;
for (final obj in allObjects) { // for (final obj in allObjects) {
_subscriptions.handle(obj.changes.listen((event) { // _subscriptions.handle(obj.changes.listen((event) {
if (event.isDirty) { // if (event.isDirty) {
isDirty = true; // isDirty = true;
if (event.object is KdbxGroup) { // if (event.object is KdbxGroup) {
Future(() { // Future(() {
// resubscribe, just in case some child groups/entries have changed. // // resubscribe, just in case some child groups/entries have changed.
_subscriptions.cancelSubscriptions(); // _subscriptions.cancelSubscriptions();
_subscribeToChildren(); // _subscribeToChildren();
}); // });
} // }
} // }
})); // }));
} // }
} // }
} }
class KdbxBody extends KdbxNode { class KdbxBody extends KdbxNode {

Loading…
Cancel
Save