setCurrentLocation method
Sets the current location and updates MBAudience data if the distance is > 100m from the last location @param latitude The new latitude. @param longitude The new longitude.
Implementation
Future<void> setCurrentLocation(double latitude, double longitude) async {
_MBAudienceLocation? lastLocation = _currentLocation;
_MBAudienceLocation newLocation = _MBAudienceLocation(latitude, longitude);
if (lastLocation == null) {
_currentLocation = newLocation;
return _updateLocation();
} else if (newLocation.distanceFromLocation(lastLocation) > 100) {
_currentLocation = newLocation;
return _updateLocation();
}
}