Flutter › Maps & Geolocation in Flutter
How can you properly display custom markers and draw a polyline route directly on a map, such as showing a delivery driver's own current position together with their planned route to a customer?
IntermediateAnswer
Displaying a custom marker on a GoogleMap involves creating a Marker object with a specific given position and an optionally genuinely fully custom icon, while drawing a route requires creating a Polyline object defined by a genuinely ordered list of individual LatLng coordinate points representing that particular route's own actual path, and both of these can genuinely be updated dynamically in real time as a driver's own actual position continues to genuinely change, letting a customer watch that particular delivery's own progress update live directly on the map.
Polyline(
polylineId: PolylineId('route'),
points: [LatLng(37.7749, -122.4194), LatLng(37.7849, -122.4094)],
color: Colors.blue,
)Real-world example A food delivery app draws a blue polyline directly on the map showing a driver's own current planned route to a customer's address, continuously and dynamically updating both that driver's own marker position and the polyline itself in genuine real time as they actually physically drive.