createEndLoc method

Future<void> createEndLoc(
  1. LatLng startLocation,
  2. LatLng _location
)

Function to set end location marker

Implementation

Future<void> createEndLoc(LatLng startLocation, LatLng _location) async {
  LatLng center = await getCenterLatLong([startLocation, _location]);
  String dist = await calculateDistance(startLocation, _location);
  _distance = dist;
  _endLoc = center;
  notifyListeners();

  ///Create distance marker function
  await Future.delayed((Duration(milliseconds: 100)));
  Uint8List? distanceIcon = await getUint8List(distanceKey);
  setMarkerLocation(distance, center, distanceIcon);
  notifyListeners();
}