start method

  1. @override
FutureOr<DrawRectangleCross?> start(
  1. BuildContext context,
  2. Offset focalPoint,
  3. Color color,
  4. Matrix4 transform,
  5. Size size,
)
override

Returning null will discard the object.

Returning a Future will prevent update() and end() from being called. The reason for this is that there's no good way of delaying those events until the Future completes. The Future should complete with either a fully constructed DrawObject or null to discard it.

Implementation

@override
FutureOr<DrawRectangleCross?> start(
  BuildContext context,
  Offset focalPoint,
  Color color,
  Matrix4 transform,
  Size size,
) {
  final point = _createPoint(focalPoint, color, transform);
  return DrawRectangleCross(
    adapter: this,
    id: _uuid.v4(),
    color: color,
    strokeWidth: width / transform.getMaxScaleOnAxis(),
    anchor: point,
    hitboxExtent: hitboxExtent,
    debugHitboxes: debugHitboxes,
  );
}