-
Notifications
You must be signed in to change notification settings - Fork 0
Collections
Efra Espada edited this page Feb 22, 2024
·
4 revisions
A Collection
object is required to work with collections:
final chatsCollection = Collection(
reference: FirebaseFirestore.instance.collection('chats'),
query: (query) => query
.where(
'member',
arrayContains: 'your_logged_user_id',
)
.orderBy('lastChange', descending: true)
.itemsPerPage(10), // Required for pagination
);
You can also fetch data from CollectionGroup
.
final chatsCollection = CollectionGroup(
reference: FirebaseFirestore.instance.collectionGroup('chats'),
query: (query) => query
.where(
'member',
arrayContains: 'your_logged_user_id',
)
.orderBy('lastChange', descending: true)
.itemsPerPage(10), // Required for pagination
);