Draggable<T extends Object> constructor Null safety

const Draggable<T extends Object>(
  1. {Key? key,
  2. required Widget child,
  3. required Widget feedback,
  4. T? data,
  5. Axis? axis,
  6. Widget? childWhenDragging,
  7. Offset feedbackOffset = Offset.zero,
  8. @Deprecated('Use dragAnchorStrategy instead. ' 'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". ' 'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". ' 'This feature was deprecated after v2.1.0-10.0.pre.') DragAnchor dragAnchor = DragAnchor.child,
  9. DragAnchorStrategy? dragAnchorStrategy,
  10. Axis? affinity,
  11. int? maxSimultaneousDrags,
  12. VoidCallback? onDragStarted,
  13. DragUpdateCallback? onDragUpdate,
  14. DraggableCanceledCallback? onDraggableCanceled,
  15. DragEndCallback? onDragEnd,
  16. VoidCallback? onDragCompleted,
  17. bool ignoringFeedbackSemantics = true,
  18. bool rootOverlay = false,
  19. HitTestBehavior hitTestBehavior = HitTestBehavior.deferToChild}
)

Creates a widget that can be dragged to a DragTarget.

The child and feedback arguments must not be null. If maxSimultaneousDrags is non-null, it must be non-negative.

Implementation

const Draggable({
  Key? key,
  required this.child,
  required this.feedback,
  this.data,
  this.axis,
  this.childWhenDragging,
  this.feedbackOffset = Offset.zero,
  @Deprecated(
    'Use dragAnchorStrategy instead. '
    'Replace "dragAnchor: DragAnchor.child" with "dragAnchorStrategy: childDragAnchorStrategy". '
    'Replace "dragAnchor: DragAnchor.pointer" with "dragAnchorStrategy: pointerDragAnchorStrategy". '
    'This feature was deprecated after v2.1.0-10.0.pre.',
  )
  this.dragAnchor = DragAnchor.child,
  this.dragAnchorStrategy,
  this.affinity,
  this.maxSimultaneousDrags,
  this.onDragStarted,
  this.onDragUpdate,
  this.onDraggableCanceled,
  this.onDragEnd,
  this.onDragCompleted,
  this.ignoringFeedbackSemantics = true,
  this.rootOverlay = false,
  this.hitTestBehavior = HitTestBehavior.deferToChild,
}) : assert(child != null),
     assert(feedback != null),
     assert(ignoringFeedbackSemantics != null),
     assert(maxSimultaneousDrags == null || maxSimultaneousDrags >= 0),
     super(key: key);