geopointFromMap static method
GeoPoint?
geopointFromMap({})
Implementation
@visibleForTesting
static GeoPoint? geopointFromMap({
required String field,
required Map<String, dynamic> snapData,
}) {
// split and fetch geoPoint from the nested Map
final fieldList = field.split('.');
Map<dynamic, dynamic>? geoPointField = snapData[fieldList[0]];
if (fieldList.length > 1) {
for (int i = 1; i < fieldList.length; i++) {
geoPointField = geoPointField?[fieldList[i]];
}
}
return geoPointField?['geopoint'] as GeoPoint?;
}