You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now I want to query this location but for some reason, I get no response and no error from the database, I can't figure out what is wrong, My position of latitude and longitude is within the 50 km radius of the availableDrivers lat long ? Do I need to add anything more to my code below ? Is it an issue with the path? Do I need to specify the url to availableDriver if so how?
Future<void> initGeoFireListener() async {
print("drivers initiation");
String pathToReference = "availableDrivers";
Geofire.initialize(pathToReference);
print("Drivers ${initPosition.latitude} ${initPosition.longitude}");
try {
Geofire.queryAtLocation(
initPosition.latitude, initPosition.longitude, 50) //10 km
.listen((map) {
print("drivers map: $map");
if (map != null) {
print("drivers is not null");
var callBack = map['callBack'];
switch (callBack) {
case Geofire.onKeyEntered:
NearByAvailableDrivers nearByAvailableDrivers =
NearByAvailableDrivers(
map['key'], map['latitude'], map['longitude']);
GeoFireAssistant.nearByAvailableDriversList
.add(nearByAvailableDrivers);
if (nearbyAvailableDriverKeysLoaded == true) {
updateAvailableDriversOnMap();
}
break;
case Geofire.onKeyExited: //when any driver is offline
//keysRetrieved.remove(map["key"]);
GeoFireAssistant.removeDriverFromList(map['key']);
updateAvailableDriversOnMap();
break;
case Geofire.onKeyMoved: //as driver position change
NearByAvailableDrivers nearByAvailableDrivers =
NearByAvailableDrivers(
map['key'], map['latitude'], map['longitude']);
GeoFireAssistant.updateDriverNearByLocation(
nearByAvailableDrivers);
updateAvailableDriversOnMap();
break;
case Geofire.onGeoQueryReady:
print(map['result']);
break;
}
} else {
print("Drivers Null");
}
//setState(() {});
}).onError((error) {
print("Drivers error $error");
});
} on PlatformException {
print("Drivers : No platformException response");
}
}
In my realtime database I have correctly set up the Location for
availableDrivers
as shown in the picture belowNow I want to query this location but for some reason, I get no response and no error from the database, I can't figure out what is wrong, My position of latitude and longitude is within the 50 km radius of the
availableDrivers
lat long ? Do I need to add anything more to my code below ? Is it an issue with the path? Do I need to specify the url toavailableDriver
if so how?Realtime database rules
The text was updated successfully, but these errors were encountered: