flutter firestore timestamp to datetime
DateTime.parse(timestamp.toDate().toString())
flutter firestore timestamp to datetime
DateTime.parse(timestamp.toDate().toString())
flutter firebase timestamp
Future<List<Post>> getAllPost(Post lastFetched, int fetchLimit) async {
List<Post> _postList = [];
if (lastFetched == null) {
_querySnapshot = await Firestore.instance
.collection("posts")
.orderBy("liked", descending: true)
.limit(fetchLimit)
.getDocuments();
} else {
_querySnapshot = await Firestore.instance
.collection("posts")
.orderBy("liked", descending: true)
.startAfterDocument(lastDocument)
.limit(fetchLimit)
.getDocuments();
}
if (_querySnapshot.documents.length != 0) {
lastDocument =
_querySnapshot.documents[_querySnapshot.documents.length - 1];
}
for (DocumentSnapshot documentSnapshot in _querySnapshot.documents) {
Post tekPost = Post.fromMap(documentSnapshot.data);
_postList.add(tekPost);
}
return _postList;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us