1

i have many document inside a collection of firebase. But i want to retrieve only the last document which is present at the bottom. You can see the image . i want to retrieve the highlighted document

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
D. Go.
  • 317
  • 1
  • 4
  • 17

1 Answers1

3

You can use last in following way to get last document.

Firestore.instance.collection("data").snapshots().last

This will give you only last element.

Viren V Varasadiya
  • 22,036
  • 7
  • 39
  • 55