Flutter Firestore Geo query

旧时模样 提交于 2019-12-24 15:06:26

问题


WHAT I HAVE TO DO:

I'm building an application where I want to do a query in firebase and receive the users who are in a range of X kilometers. But I want to limit this received documents and also to have a function for getting more documents on the scroll. I'm using a StreamBuilder->ListView.build in order to build my list. When I'm going to receive the end of the scrollable list I want to get more documents from Firestore (if I have any).


WHAT I'VE DONE ALREADY:

So far I found just 2 solutions for my problem:

  1. Firestore Helpers
  2. GeoFlutterFire

THE PROBLEM:

Both of those libraries are good with just one BIG problem, in both of this case I'm not able to limit the number of documents that I'm going to receive (I can JUST limit the original query for Firestore.instance.collection("MyColection")) but is not going to help me that much because I will have this case

Give me 10 documents from Firestore -> Give me the 5km range users -> I will receive just 4 let's say.

What I want instead is to receive 10 documents from Firestore within a range of X.

Is there any solution for this problem? Or I need to implement my own library for this? Or is not possible even so?

来源:https://stackoverflow.com/questions/56674470/flutter-firestore-geo-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!