Skip to content

Commit

Permalink
Update archiecture.md (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
dungngminh authored Sep 22, 2024
1 parent b2460b6 commit 1730615
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
},
);
Expand Down Expand Up @@ -121,6 +122,12 @@ class UserModel {
return UserModel(name: json['name']);
}
Map<String, dynamic> toJson() {
return {
'name': name,
};
}
static Collection<UserModel> get store {
return Loon.collection<UserModel>(
'users',
Expand Down Expand Up @@ -172,6 +179,12 @@ class UserModel {
return UserModel(name: json['name']);
}
Map<String, dynamic> toJson() {
return {
'name': name,
};
}
static Collection<UserModel> get store {
return Loon.collection<UserModel>(
'users',
Expand Down Expand Up @@ -202,10 +215,16 @@ class UserModel {
return UserModel(name: json['name']);
}
Map<String, dynamic> toJson() {
return {
'name': name,
};
}
static Collection<UserModel> get store {
return Loon.collection<TestUserModel>(
return Loon.collection<UserModel>(
'users',
fromJson: TestUserModel.fromJson,
fromJson: UserModel.fromJson,
toJson: (user) => user.toJson(),
persistorSettings: FilePersistorSettings(
key: FilePersistor.keyBuilder(
Expand Down

0 comments on commit 1730615

Please sign in to comment.