Welcome back.
We finished the retrofit section.
Now let's move to the repositories.
Create a new interface.
Name it as directions repository.
We need to fetch the route.
Let's fetch the route between the current position and a marker.
So we need a suspend function.
Get directions or get or get route.
We need an origin which is a left lung.
And we need a destination which is a left lung.
Also this will return a list of left lungs.
Why?
Because, um, in Google Maps, every segment, every leg, every step, every, uh, lag between two
points is defined as a two markers and a straight line.
So we need to collect all those markers in a list of left lungs and display them as a complete route
or a polyline.
So this is the idea behind returning a list of all markers between Origin and destination in order to
display the route.
Okay.
The second function we need to talk about it is fetching the route between multiple markers.
Let's start with suspend function.
Get route for multiple markers.
Here we need to specify the origin.
We need to specify that destination and the way points.
So way points list of lat long.
And the destination is a single marker.
Why we use the waypoints as a list.
The origin is a marker.
The destination is a marker.
And between those two points we have the waypoints, which is a list of lat long.
This list contains all the markers between the origin and destination that we want to display the route
between them, including the waypoints.
So we have the origin starting from this marker.
Then we move through the waypoints.
maybe one, maybe 50 markers and so on until reaching the destination.
By the way, there is a limit which is 24 markers in Google Maps.
This is due to the complex algorithms that we need to execute during fetching the route, and the fastest
route between the destination origin and including the way points.
So this is a big, um, big query and big request.
Even Google Maps will will restrict you from making more than 24 markers, because there are a lot of
algorithms will work in order to get your response.
Okay, so the idea here is the origin destination.
And through this route we have waypoints.
We need to fetch the the origin, the markers included in the waypoints and then reaching the destination.
Okay.
So we have two main functions in our application we need to work on.