drawArrow method
Draws line as well as the arrowhead on top of it.
Uses strokeWidth
of the painter for sizing.
Implementation
void drawArrow(Canvas canvas, Offset start, Offset end, Paint painter) {
final arrowPainter = Paint()
..color = painter.color
..strokeWidth = painter.strokeWidth
..style = PaintingStyle.stroke;
canvas.drawLine(start, end, painter);
final _pathOffset = painter.strokeWidth / 15;
final path = Path()
..lineTo(-15 * _pathOffset, 10 * _pathOffset)
..lineTo(-15 * _pathOffset, -10 * _pathOffset)
..close();
canvas.save();
canvas.translate(end.dx, end.dy);
canvas.rotate((end - start).direction);
canvas.drawPath(path, arrowPainter);
canvas.restore();
}