diff --git a/architecture.md b/architecture.md index 80d0352..c61d233 100644 --- a/architecture.md +++ b/architecture.md @@ -65,11 +65,12 @@ If the broadcast observer has changes, then it emits its updated data to its lis Documents can specify that they depend on other documents and that they should react to changes to those documents. ```dart + Loon.collection( 'posts', dependenciesBuilder: (postSnap) { return { - Loon.collection('users').doc(postSnap.data.userId)), + Loon.collection('users').doc(postSnap.data.userId), }; }, ); @@ -121,6 +122,12 @@ class UserModel { return UserModel(name: json['name']); } + Map toJson() { + return { + 'name': name, + }; + } + static Collection get store { return Loon.collection( 'users', @@ -172,6 +179,12 @@ class UserModel { return UserModel(name: json['name']); } + Map toJson() { + return { + 'name': name, + }; + } + static Collection get store { return Loon.collection( 'users', @@ -202,10 +215,16 @@ class UserModel { return UserModel(name: json['name']); } + Map toJson() { + return { + 'name': name, + }; + } + static Collection get store { - return Loon.collection( + return Loon.collection( 'users', - fromJson: TestUserModel.fromJson, + fromJson: UserModel.fromJson, toJson: (user) => user.toJson(), persistorSettings: FilePersistorSettings( key: FilePersistor.keyBuilder(