CupertinoSwitch constructor Null safety

const CupertinoSwitch(
  1. {Key? key,
  2. required bool value,
  3. required ValueChanged<bool>? onChanged,
  4. Color? activeColor,
  5. Color? trackColor,
  6. Color? thumbColor,
  7. DragStartBehavior dragStartBehavior = DragStartBehavior.start}
)

Creates an iOS-style switch.

The value parameter must not be null. The dragStartBehavior parameter defaults to DragStartBehavior.start and must not be null.

Implementation

const CupertinoSwitch({
  super.key,
  required this.value,
  required this.onChanged,
  this.activeColor,
  this.trackColor,
  this.thumbColor,
  this.dragStartBehavior = DragStartBehavior.start,
}) : assert(value != null),
     assert(dragStartBehavior != null);