如何计算扑扑200米以内的附近居民名单?

我想显示附近的人的名单。如何使循环计算所有数据库的纬度和经度,并给我附近的人名单,以便我可以向他们发送通知。哪个API对此有帮助?以及如何实现所有这些东西?

imauzhw 回答:如何计算扑扑200米以内的附近居民名单?

选中geolocator

此插件具有一种计算两个位置之间距离的方法

double distanceInMeters = await Geolocator().distanceBetween(startLatitude,startLongitude,endLatitude,endLongitude);

您可以循环查看附近的人

for (var person in people) {
      double distanceInMeters = await Geolocator().distanceBetween(thisLatitude,thisLongitude,person.Latitude,person.Longitude);
      if(distanceInMeters<=200){
        notification();
      }
    }
本文链接:https://www.f2er.com/3127955.html

大家都在问