это то, что функция, которая устанавливает значения полилинии:
Код: Выделить всё
Future getDirections({
required LatLng origin,
required LatLng destination,
}) async {
final response = await _dio.get(
_baseURL,
queryParameters: {
'origin': LatLng(
LocationManager.shared.currentPos?.latitude ?? 0.0,
LocationManager.shared.currentPos?.longitude ?? 0.0,
),
'destination': '',
'key': google_API_Key,
},
);
if (response.statusCode == 200) {
return Directions.fromMap(response.data);
}
return null;
}
}
< /code>
Я называю его в главном виджете Googlemap, подав ему необходимую информацию, но я не могу придумать способ настроить A для цикла, чтобы определить ближайший маркер в моем текущем месте.class Station {
String stationName;
String address;
String thumbNail;
LatLng locationCoords;
Station({
required this.stationName,
required this.address,
required this.thumbNail,
required this.locationCoords,
});
}
final List evStations = [
Station(
stationName: '**********',
address: '**********',
thumbNail: 'assets/mapicons/***.png',
locationCoords: LatLng(**.******, **.******),
),
Подробнее здесь: https://stackoverflow.com/questions/796 ... -of-a-pool