startNavigation method

  1. @override
Future<bool?> startNavigation({
  1. MapOptions? options,
})
override

Show the Navigation View and Begins Direction Routing

wayPoints must not be null and have at least 2 items. A collection of WayPoint(longitude, latitude and name). Must be at least 2 or at most 25. Cannot use drivingWithTraffic mode if more than 3-waypoints. options options used to generate the route and used while navigating Begins to generate Route Progress

Implementation

@override
Future<bool?> startNavigation({MapOptions? options}) async {
  // assert(wayPoints.length > 1, 'Error: WayPoints must be at least 2');
  // if (Platform.isIOS && wayPoints.length > 3) {
  //   assert(options.mode != MapNavigationMode.drivingWithTraffic, '''
  //         Error: Cannot use drivingWithTraffic Mode when you have more than 3 Stops
  //       ''');
  // }

  // final pointList = _getPointListFromWayPoints(wayPoints);
  // var i = 0;
  // final wayPointMap = {for (var e in pointList) i++: e};
  final args = options?.toMap();
  // args['wayPoints'] = wayPointMap;
  _routeEventSubscription = routeEventsListener!.listen(_onProgressData);
  final result = await methodChannel.invokeMethod('startNavigation', args);
  if (result is bool) return result;
  log(result.toString());
  return false;
}