I have to increase the call time of setLocation() because I spend so much on google APIs (in 2 days 100€ and I am only testing the app). I have tried timers and debounce functions but have not yet been able to come up with a solution.
updateDriversLocationAtRealTime()
{
streamSubscriptionPosition = Geolocator.getPositionStream()
.listen((Position position)
{
driverCurrentPosition = position;
if(isDriverActive == true)
{
Geofire.setLocation(
currentFirebaseUser!.uid,
driverCurrentPosition!.latitude,
driverCurrentPosition!.longitude
);
}
LatLng latLng = LatLng(
driverCurrentPosition!.latitude,
driverCurrentPosition!.longitude,
);
newGoogleMapController!.animateCamera(CameraUpdate.newLatLng(latLng));
});
}