DarshanGowda0 / GeoFlutterFire

:fire:GeoFlutterFire:fire: is an open-source library that allows you to store and query firestore documents based on their geographic location.
https://youtu.be/MYHVyl-juUk
MIT License
305 stars 261 forks source link

The within method has broken. #79

Closed spiderion closed 4 years ago

spiderion commented 4 years ago

Looks like with the new flutter update is not possible to set data on The documentSnapshot.data[]

documentSnapshot.data['distance'] = center.distance(lat: geoPoint.latitude, lng: geoPoint.longitude);

var distance = documentSnapshot.data['distance'] ; print(distance) // will be null

wilfred-asomanii commented 4 years ago

I've realised it has something to do with a change in the latest version of cloud_firestore package, which geoflutterfire depends on. Downgrading to 0.12.11 fixes this.

in cloud_firestore 0.12.11, data is a field in the latest versions, data is a getter

spiderion commented 4 years ago

@DarshanGowda0 any planned fix for this?

flutterfrank commented 4 years ago

I've realised it has something to do with a change in the latest version of cloud_firestore package, which geoflutterfire depends on. Downgrading to 0.12.11 fixes this. in cloud_firestore 0.12.11, data is a field in the latest versions, data is a getter

cloud_firestore 0.13.0+1 (+2?) also works with geoflutterfire.

spiderion commented 4 years ago

https://github.com/DarshanGowda0/GeoFlutterFire/pull/80 @DarshanGowda0 please have a look

Toernblom commented 4 years ago

80

@DarshanGowda0 please have a look

This worked wonders.

DarshanGowda0 commented 4 years ago

Thanks @spiderion for the fix

flutterfrank commented 4 years ago

But where can I find the 'distance' field in the DocumentSnapshot now?

Nairou commented 4 years ago

But where can I find the 'distance' field in the DocumentSnapshot now?

This is what I came here to find out as well. Looks like it's contained in DistanceDocSnapshot, but the .within() query only returns the inner DocumentSnapshot...