Skip to content

Commit 961e896

Browse files
authored
Feat/modified collection reference (#14)
* modified snapshot * update README
1 parent b98e22d commit 961e896

36 files changed

+43
-503
lines changed

README.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,10 @@ Can be used get and paging features of documents by CollectionPaging.
219219
Query of Collection.
220220

221221
```dart
222-
final ref = User().collectionRef;
223222
final collectionPaging = CollectionPaging<User>(
224223
query: User().collectionRef.orderBy('createdAt', descending: true),
225224
limit: 20,
226-
collectionRef: ref,
227-
decode: (snap, collectionRef) =>
228-
User(snapshot: snap, collectionRef: collectionRef),
225+
decode: (snap) => User(snapshot: snap),
229226
);
230227
231228
List<User> items = [];
@@ -247,8 +244,7 @@ final collectionPaging = CollectionPaging<User>(
247244
.collectionGroup('user')
248245
.orderBy('createdAt', descending: true),
249246
limit: 20,
250-
decode: (snap, _) =>
251-
User(snapshot: snap, collectionRef: snap.reference.parent),
247+
decode: (snap) => User(snapshot: snap),
252248
);
253249
```
254250

@@ -262,8 +258,7 @@ final collectionPagingListener = CollectionPagingListener<User>(
262258
query: User().collectionRef.orderBy('updatedAt', descending: true),
263259
initialLimit: 20,
264260
pagingLimit: 20,
265-
decode: (snap, _) =>
266-
User(snapshot: snap, collectionRef: snap.reference.parent),
261+
decode: (snap) => User(snapshot: snap),
267262
);
268263
269264
// Fetch to set listener.
@@ -611,7 +606,7 @@ await batch.commit();
611606
// Get sub collection
612607
final path = ranking.count.ref.path;
613608
final snapshot = await firestoreInstance.collection(path).get();
614-
final list = snapshot.docs.map((item) => Count(snapshot: item, collectionRef: ranking.count.ref)).toList()
609+
final list = snapshot.docs.map((item) => Count(snapshot: item)).toList()
615610
..forEach((count) {
616611
print(count);
617612
});

README_j.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,10 @@ await batch.commit();
233233
CollectionPagingを使えばドキュメントのページング取得ができます。
234234

235235
```dart
236-
final ref = User().collectionRef;
237236
final collectionPaging = CollectionPaging<User>(
238237
query: User().collectionRef.orderBy('createdAt', descending: true),
239238
limit: 20,
240-
collectionRef: ref,
241-
decode: (snap, collectionRef) =>
242-
User(snapshot: snap, collectionRef: collectionRef),
239+
decode: (snap) => User(snapshot: snap),
243240
);
244241
245242
List<User> items = [];
@@ -261,8 +258,7 @@ final collectionPaging = CollectionPaging<User>(
261258
.collectionGroup('user')
262259
.orderBy('createdAt', descending: true),
263260
limit: 20,
264-
decode: (snap, _) =>
265-
User(snapshot: snap, collectionRef: snap.reference.parent),
261+
decode: (snap) => User(snapshot: snap),
266262
);
267263
```
268264

@@ -279,8 +275,7 @@ final collectionPagingListener = CollectionPagingListener<User>(
279275
query: User().collectionRef.orderBy('updatedAt', descending: true),
280276
initialLimit: 20,
281277
pagingLimit: 20,
282-
decode: (snap, _) =>
283-
User(snapshot: snap, collectionRef: snap.reference.parent),
278+
decode: (snap) => User(snapshot: snap),
284279
);
285280
286281
// Fetch to set listener.
@@ -642,7 +637,7 @@ await batch.commit();
642637
// Get sub collection
643638
final path = ranking.count.ref.path; // ※2
644639
final snapshot = await firestoreInstance.collection(path).get();
645-
final list = snapshot.docs.map((item) => Count(snapshot: item, collectionRef: ranking.count.ref)).toList()
640+
final list = snapshot.docs.map((item) => Count(snapshot: item)).toList()
646641
..forEach((count) {
647642
print('${count.userId}, ${count.count}');
648643
});

flamingo/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ doc/api/
2222

2323
# Intellij
2424
*.iml
25+
.idea
2526
.idea/*
2627
!.idea/codeStyleSettings.xml
2728
!.idea/codeStyles/*

flamingo/.idea/vcs.xml

-6
This file was deleted.

flamingo/CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# 1.7.0
1+
# 1.8.0
2+
Modified to set Collection Reference by Snapshot.
3+
4+
## 1.7.0
25
Updated Plugins.
36

47
## 1.6.0

flamingo/README.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,10 @@ Can be used get and paging features of documents by CollectionPaging.
219219
Query of Collection.
220220

221221
```dart
222-
final ref = User().collectionRef;
223222
final collectionPaging = CollectionPaging<User>(
224223
query: User().collectionRef.orderBy('createdAt', descending: true),
225224
limit: 20,
226-
collectionRef: ref,
227-
decode: (snap, collectionRef) =>
228-
User(snapshot: snap, collectionRef: collectionRef),
225+
decode: (snap) => User(snapshot: snap),
229226
);
230227
231228
List<User> items = [];
@@ -247,8 +244,7 @@ final collectionPaging = CollectionPaging<User>(
247244
.collectionGroup('user')
248245
.orderBy('createdAt', descending: true),
249246
limit: 20,
250-
decode: (snap, _) =>
251-
User(snapshot: snap, collectionRef: snap.reference.parent),
247+
decode: (snap) => User(snapshot: snap),
252248
);
253249
```
254250

@@ -262,8 +258,7 @@ final collectionPagingListener = CollectionPagingListener<User>(
262258
query: User().collectionRef.orderBy('updatedAt', descending: true),
263259
initialLimit: 20,
264260
pagingLimit: 20,
265-
decode: (snap, _) =>
266-
User(snapshot: snap, collectionRef: snap.reference.parent),
261+
decode: (snap) => User(snapshot: snap),
267262
);
268263
269264
// Fetch to set listener.
@@ -611,7 +606,7 @@ await batch.commit();
611606
// Get sub collection
612607
final path = ranking.count.ref.path;
613608
final snapshot = await firestoreInstance.collection(path).get();
614-
final list = snapshot.docs.map((item) => Count(snapshot: item, collectionRef: ranking.count.ref)).toList()
609+
final list = snapshot.docs.map((item) => Count(snapshot: item)).toList()
615610
..forEach((count) {
616611
print(count);
617612
});

flamingo/android/.gitignore

-8
This file was deleted.

flamingo/android/.idea/$CACHE_FILE$

-50
This file was deleted.

flamingo/android/.idea/codeStyles/Project.xml

-149
This file was deleted.

flamingo/android/.idea/codeStyles/codeStyleConfig.xml

-5
This file was deleted.

flamingo/android/.idea/compiler.xml

-8
This file was deleted.

flamingo/android/.idea/dictionaries

-6
This file was deleted.

0 commit comments

Comments
 (0)