ScrollDragController constructor Null safety

ScrollDragController(
  1. {required ScrollActivityDelegate delegate,
  2. required DragStartDetails details,
  3. VoidCallback? onDragCanceled,
  4. double? carriedVelocity,
  5. double? motionStartDistanceThreshold}
)

Creates an object that scrolls a scroll view as the user drags their finger across the screen.

The delegate and details arguments must not be null.

Implementation

ScrollDragController({
  required ScrollActivityDelegate delegate,
  required DragStartDetails details,
  this.onDragCanceled,
  this.carriedVelocity,
  this.motionStartDistanceThreshold,
}) : assert(delegate != null),
     assert(details != null),
     assert(
       motionStartDistanceThreshold == null || motionStartDistanceThreshold > 0.0,
       'motionStartDistanceThreshold must be a positive number or null',
     ),
     _delegate = delegate,
     _lastDetails = details,
     _retainMomentum = carriedVelocity != null && carriedVelocity != 0.0,
     _lastNonStationaryTimestamp = details.sourceTimeStamp,
     _offsetSinceLastStop = motionStartDistanceThreshold == null ? null : 0.0;