addZone method

Future<Zone> addZone(
  1. String zoneName,
  2. String type,
  3. Map<String, dynamic> geometry, {
  4. double? maxSpeed,
  5. Map<String, dynamic>? extra,
})

Create a keep-out or speed-limit Zone on the active map. type is either keepout or speed_limit, and geometry describes a circle, box, or polygon. maxSpeed, in meters per second, is required for a speed_limit zone.

// Example:
final zone = await myNavigationService.addZone('stairs', 'keepout', {'type': 'circle', 'x': 0, 'y': 0, 'r': 1});

For more information, see the navigation service docs.

Implementation

Future<Zone> addZone(
  String zoneName,
  String type,
  Map<String, dynamic> geometry, {
  double? maxSpeed,
  Map<String, dynamic>? extra,
}) async {
  final request = AddZoneRequest(
    name: name,
    zoneName: zoneName,
    type: type,
    geometry: geometry.toStruct(),
    maxSpeed: maxSpeed,
    extra: extra?.toStruct(),
  );
  final response = await client.addZone(request, options: callOptions);
  return response.zone;
}