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
  • 565,676
  • 79
  • 828
  • 807
D. Go.
  • 407
  • 1
  • 9
  • 22

1 Answers1

4

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
  • 25,492
  • 9
  • 45
  • 61