Skip to main content
GuidesAPI ReferenceExamplesFAQ

Display route instructions

|

Instructions are represented as arrows on the map and can be displayed by using GemMapController.centerOnRouteInstruction(instruction, zoomLevel: zoomLevel). To obtain a route's instructions, see the Get the route segments and instructions section. The following example iterates through all instructions of the first segment of a route and displays each one by centering:

for (final instruction in route.segments.first.instructions) {
mapController.centerOnRouteInstruction(instruction, zoomLevel: 75);

await Future.delayed(Duration(seconds: 3));
}
Turn right arrow instruction

In order to remove the instruction arrow from the map, use GemMapController.clearRouteInstruction() method. The route instruction arrow is automatically cleared when a new route instruction is centered on or when the route is cleared.