flutter_geofire icon indicating copy to clipboard operation
flutter_geofire copied to clipboard

Geofire query is run on old location path, even after initialising it with a new location path.

Open prasundubey opened this issue 4 years ago • 5 comments

Hi, I'm getting this issues while querying a new path in a session.

I have made 2 sites for storing the location of male & female separately. When a user wants to see only male in their location as per their initial selection, the query is run successfully and returns male in the given radius. But if the selection is changed to female, and Geofire is initialised to a new location path where female locations are stored..The query is still run on the pervious initialised location, and returns ids for male location rather than female. Though the query return correct data on path initialised at first, either male or female.

Example code:

if(userInterest == male) await Geofire.initialize(LocationBySex/male); else if (userInterest == female) await Geofire.initialize(LocationBySex/female);*/ try { Geofire.queryAtLocation(location.latitude, location.longitude, dynamicRadius).listen((map) {....}

prasundubey avatar Jun 20 '21 07:06 prasundubey

Has anyone tried to fix this as I am having the same issue?

gbrain2001 avatar Jul 15 '21 20:07 gbrain2001

hey guys, could you solve it? @prasundubey @gbrain2001 @mrdishant

marcusrohden avatar Dec 08 '21 00:12 marcusrohden

Have you tried removing the listener and then initializing again? bool response = await Geofire.stopListener();

mrdishant avatar Dec 08 '21 08:12 mrdishant

Hi @mrdishant, we're running into the same problem. After using queryAtLocation().listen(), we canceled the StreamSubscription, called Geofire.stopListener() and ensured the correct execution order using a mutex before calling Geofire.initialize() again with a different path. However, any new queries will still run on the old path.

Laurin-G avatar Aug 10 '22 18:08 Laurin-G

same issue here. the listener keeps use the old location . we need this issue to be solved!

slender2332 avatar Aug 10 '23 15:08 slender2332