Skip to main content
GuidesAPI ReferenceExamplesFAQ

Display route instructions

Estimated reading time: 1 minute

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));
}
hello_map
Turn right arrow instruction
warning

Only one instruction can be displayed at a time. To remove it, the displayed route which contains the instruction must be removed using either mapController.preferences.routes.clear or by specifying the route with mapController.preferences.routes.remove(route).