From 17306159860a402e614dd14da4027e32cf63299e Mon Sep 17 00:00:00 2001 From: Dung Nguyen Minh <63831488+dungngminh@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:28:22 +0700 Subject: [PATCH] Update archiecture.md (#14) --- architecture.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) 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(