addCircle method

Future<ShapeId> addCircle({
  1. required GeoPoint center,
  2. required double radius,
  3. required Color color,
  4. Color? borderColor,
  5. double strokeWidth = 1,
  6. ShapeId? shapeId,
})

Implementation

Future<ShapeId> addCircle({
  required GeoPoint center,
  required double radius,
  required Color color,
  Color? borderColor,
  double strokeWidth = 1,
  ShapeId? shapeId,
}) async {
  if (!radius.isFinite ||
      radius <= 0 ||
      !strokeWidth.isFinite ||
      strokeWidth <= 0) {
    throw _argumentException(_controller, 'addCircle', 'invalid_shape');
  }
  final id = _issue(shapeId, 'addCircle');
  try {
    final transport = await _controller._readyTransport();
    await transport.addCircle(
      shapeId: id,
      center: center,
      radius: radius,
      fillColor: _signedArgb(color),
      borderColor: _signedArgb(borderColor ?? color),
      strokeWidth: strokeWidth,
    );
    return id;
  } catch (_) {
    _issuedIds.remove(id);
    rethrow;
  }
}