SingleChildScrollView constructor Null safety

const SingleChildScrollView(
  1. {Key? key,
  2. Axis scrollDirection = Axis.vertical,
  3. bool reverse = false,
  4. EdgeInsetsGeometry? padding,
  5. bool? primary,
  6. ScrollPhysics? physics,
  7. ScrollController? controller,
  8. Widget? child,
  9. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  10. Clip clipBehavior = Clip.hardEdge,
  11. String? restorationId,
  12. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual}
)

Creates a box in which a single widget can be scrolled.

Implementation

const SingleChildScrollView({
  super.key,
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.padding,
  this.primary,
  this.physics,
  this.controller,
  this.child,
  this.dragStartBehavior = DragStartBehavior.start,
  this.clipBehavior = Clip.hardEdge,
  this.restorationId,
  this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
}) : assert(scrollDirection != null),
     assert(dragStartBehavior != null),
     assert(clipBehavior != null),
     assert(
       !(controller != null && (primary ?? false)),
       'Primary ScrollViews obtain their ScrollController via inheritance '
       'from a PrimaryScrollController widget. You cannot both set primary to '
       'true and pass an explicit controller.',
     );