- The map draw polygons and markers but the polyline is not showing, the code is the following:
GoogleMap(
onMapCreated: _onMapCreated,
onCameraMove: _onCameraMove,
onCameraIdle: _onCameraIdle,
polygons: getPolygonList(zonesCubit.state.zonesCubit.data!, spotsCubit, zonesCubit) : {},
polylines: {
const Polyline(
points: [LatLng(-74.813255, 11.004145), LatLng(-74.81268, 11.003933), LatLng(-74.809933, 11.002921), LatLng(-74.809641, 11.002813)],
polylineId: PolylineId("howto"),
),
},
markers: Marker(
markerId: const MarkerId("CURRENT_USER"),
position: currentPosition,
icon: carIcon
),
initialCameraPosition:
CameraPosition(target: referencePoint, zoom: currentZoom),
),
- the marker position that represents the user current position is not being updated on map, but when re-run the app the marker now is in the new position, but only when re-run the app, the code is the following:
Marker(
markerId: const MarkerId("CURRENT_USER"),
position: currentPosition,
icon: carIcon)
and to detect user position change i´m using geolocator , the code is the following:
@override
void initState() {
super.initState();
final locationSettings = LocationSettings(accuracy: LocationAccuracy.high, distanceFilter: 5);
Geolocator.getPositionStream(locationSettings: locationSettings).listen(
(Position position) {
setState(() {
currentPosition = LatLng(position.latitude, position.longitude);
});
getit<Logger>().i("current device location: $currentPosition");
print(position == null ? 'Unknown' : '${position.latitude}, ${position.longitude}');
}
);
}
what could be happening?
I´m expecting draw the polyline and update the marker when the position is being updated