Filtering Firestore Documents by Distance Using Latlng Field

Database & APIs

I'm trying to filter a collection of posts, which have a location field where the geolocation is stored as a latlng value. The goal is to only retrieve those which are within a certain distance (say 50km) of a given point, also a latlng value. I resorted to using a custom action, but haven't been able to even run the action due to errors. If there's a way that doesn't involve custom actions, that would be preferable.

What have you tried so far?

I realized I couldn't do something like that through the query builder within Flutterflow so I tried writing a custom action that will do this for me. I used ChatGPT to write it since I'm not an expert, but I keep getting errors in my code. I've been having issues with dependencies, and different things have been getting highlighted as errors depending on what dependencies I add.

Did you check FlutterFlow's Documentation for this topic?
Yes
3 replies