ActionChip constructor Null safety

const ActionChip(
  1. {Key? key,
  2. Widget? avatar,
  3. required Widget label,
  4. TextStyle? labelStyle,
  5. EdgeInsetsGeometry? labelPadding,
  6. required VoidCallback onPressed,
  7. double? pressElevation,
  8. String? tooltip,
  9. BorderSide? side,
  10. OutlinedBorder? shape,
  11. Clip clipBehavior,
  12. FocusNode? focusNode,
  13. bool autofocus,
  14. Color? backgroundColor,
  15. EdgeInsetsGeometry? padding,
  16. VisualDensity? visualDensity,
  17. MaterialTapTargetSize? materialTapTargetSize,
  18. double? elevation,
  19. Color? shadowColor}
)

Create a chip that acts like a button.

The label, onPressed, 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 ActionChip({
  Key? key,
  this.avatar,
  required this.label,
  this.labelStyle,
  this.labelPadding,
  required this.onPressed,
  this.pressElevation,
  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,
}) : assert(label != null),
     assert(clipBehavior != null),
     assert(autofocus != null),
     assert(
       onPressed != null,
       'Rather than disabling an ActionChip by setting onPressed to null, '
       'remove it from the interface entirely.',
     ),
     assert(pressElevation == null || pressElevation >= 0.0),
     assert(elevation == null || elevation >= 0.0),
     super(key: key);