addItineraryFromMapCenter method

Future<void> addItineraryFromMapCenter({
  1. required Coordinate destination,
  2. ItinerarySearchRules? searchRules,
  3. Color? color,
})

add itinerary from map center to the specified destination

Implementation

Future<void> addItineraryFromMapCenter({
  required Coordinate destination,
  ItinerarySearchRules? searchRules,
  Color? color,
}) async {
  ItineraryWidget._startPointType = ItineraryStartPointType.mapCenter;
  final center = await _getMapCenterCoordinates();
  if (center != null) {
    ItineraryWidget._startPoint = ItineraryPoint(
      name:
          "${center.latitude.toStringAsFixed(5)}, ${center.longitude.toStringAsFixed(5)}",
      coordinate: center,
    );
  }

  await _methodChannel.invokeMethod('addItineraryFromMapCenter', {
    "destination": destination.toMap(),
    "searchRules": searchRules?.toMap() ?? ItinerarySearchRules().toMap(),
    "red": color?.red,
    "green": color?.green,
    "blue": color?.blue,
    "alpha": color?.alpha,
  });
}