DragUpdateDetails constructor Null safety

DragUpdateDetails(
  1. {Duration? sourceTimeStamp,
  2. Offset delta = Offset.zero,
  3. double? primaryDelta,
  4. required Offset globalPosition,
  5. Offset? localPosition}
)

Creates details for a DragUpdateDetails.

The delta argument must not be null.

If primaryDelta is non-null, then its value must match one of the coordinates of delta and the other coordinate must be zero.

The globalPosition argument must be provided and must not be null.

Implementation

DragUpdateDetails({
  this.sourceTimeStamp,
  this.delta = Offset.zero,
  this.primaryDelta,
  required this.globalPosition,
  Offset? localPosition,
}) : assert(delta != null),
     assert(
       primaryDelta == null
         || (primaryDelta == delta.dx && delta.dy == 0.0)
         || (primaryDelta == delta.dy && delta.dx == 0.0),
     ),
     localPosition = localPosition ?? globalPosition;