Tinder-like search based on distance in Flutter - Most efficient way?

421 Views Asked by At

Imagine an app very similar to Tinder, match users with similar interests, but only in a certain radius.

I guess similar question to this, but specifically for Flutter: How to implement a tinder-like search based on distance in Android?


The most basic idea is to just save each user's lat & long in Firestore upon app start. Then query the first e.g. 10 users from db and calculate the distance between them with something like this.

Is this all I need? I suppose I won't need something big like geoflutterfire with map visualization and whatnot. All I need is the location of each user.

So my questions are:

  1. Is geolocator the best plugin for this? Or is there something specifically suited?
  2. Is this a feasible solution for a big amount of users?

I'm worried that calculating the distance in this way will become impossible, since the app will be loading for minutes.

Or maybe I have to lean into geohashing? But that would mean I have to use geoflutterfire, am I then bound by the API calls restriction of Google Maps?


Edit: Seeing this question: Flutter Firestore Geo query, it seems like Firestore may be a bad solution for this?
Am I forced to migrate to something like Back4App which has things like withinGeoBox?

enter image description here

1

There are 1 best solutions below

1
Kyrill On

it's also possible to do it with geohashing.

you can do that with https://pub.dev/packages/geohash_plus