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