ChoiceChip constructor Null safety

const ChoiceChip(
  1. {Key? key,
  2. Widget? avatar,
  3. required Widget label,
  4. TextStyle? labelStyle,
  5. EdgeInsetsGeometry? labelPadding,
  6. ValueChanged<bool>? onSelected,
  7. double? pressElevation,
  8. required bool selected,
  9. Color? selectedColor,
  10. Color? disabledColor,
  11. String? tooltip,
  12. BorderSide? side,
  13. OutlinedBorder? shape,
  14. Clip clipBehavior = Clip.none,
  15. FocusNode? focusNode,
  16. bool autofocus = false,
  17. Color? backgroundColor,
  18. EdgeInsetsGeometry? padding,
  19. VisualDensity? visualDensity,
  20. MaterialTapTargetSize? materialTapTargetSize,
  21. double? elevation,
  22. Color? shadowColor,
  23. Color? surfaceTintColor,
  24. IconThemeData? iconTheme,
  25. Color? selectedShadowColor,
  26. ShapeBorder avatarBorder = const CircleBorder()}
)

Create a chip that acts like a radio button.

The label, selected, autofocus, and clipBehavior arguments must not be null. The pressElevation and elevation must be null or non-negative. Typically, pressElevation is greater than elevation.

Implementation

const ChoiceChip({
  super.key,
  this.avatar,
  required this.label,
  this.labelStyle,
  this.labelPadding,
  this.onSelected,
  this.pressElevation,
  required this.selected,
  this.selectedColor,
  this.disabledColor,
  this.tooltip,
  this.side,
  this.shape,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  this.backgroundColor,
  this.padding,
  this.visualDensity,
  this.materialTapTargetSize,
  this.elevation,
  this.shadowColor,
  this.surfaceTintColor,
  this.iconTheme,
  this.selectedShadowColor,
  this.avatarBorder = const CircleBorder(),
}) : assert(selected != null),
     assert(label != null),
     assert(clipBehavior != null),
     assert(autofocus != null),
     assert(pressElevation == null || pressElevation >= 0.0),
     assert(elevation == null || elevation >= 0.0);