Open Lsinkololwe opened 1 year ago
I'm encountering an issue with the same line of code, in collection.dart on line 124
final GeoPoint geoPoint = geoPointField['geopoint'];
However I get the error
flutter: type 'Null' is not a subtype of type 'GeoPoint'
flutter:
#0 GeoFireCollectionRef._buildQueryStream.<anonymous closure>.<anonymous closure> (package:geoflutterfire2/src/collection.dart:124:24)
#1 MappedListIterable.elementAt (dart:_internal/iterable.dart:425:31)
#2 ListIterator.moveNext (dart:_internal/iterable.dart:354:26)
#3 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#4 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#5 new List.of (dart:core-patch/array_patch.dart:39:18)
#6 ListIterable.toList (dart:_internal/iterable.dart:224:7)
#7 GeoFireCollectionRef._buildQueryStream.<anonymous closure> (package:geoflutterfire2/src/collection.dart:137:24)
#8 _MapStream._handleData (dart:async/stream_pipe.dart:213:31)
#9 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#10 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#11 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:33<…>
It only seems to be an issue on iOS for me, same code works fine on Android. Any idea what this could be?
I'm using v2.3.15 and it's still happening.
After a long time, I discovered that the problem was the data type in the database.
I had something like this:
And I changed it to this:
from "map" to "geopoint".
It could be resolved by changing the line you mentioned from:
final GeoPoint geoPoint = geoPointField['geopoint']
;
To:
final GeoPoint geoPoint = geoPointField['geopoint'] as GeoPoint;
I hope this can be like this in the next version.
@monika-with-a-k If you have a null field, you should change it to a "geopoint", or ignore the records where yourField is null in your database query
It's solved now. Thanks
Team i'm encountering the below error coming from the collection .dart file.
E/flutter ( 9784): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'GeoPoint' E/flutter ( 9784): #0 GeoFireCollectionRef._buildQueryStream.. (package:geoflutterfire2/src/collection.dart:124:24)
The code in the library on line 124 is
final GeoPoint geoPoint = geoPointField['geopoint'];