Chip constructor Null safety

const Chip(
  1. {Key? key,
  2. Widget? avatar,
  3. required Widget label,
  4. TextStyle? labelStyle,
  5. EdgeInsetsGeometry? labelPadding,
  6. Widget? deleteIcon,
  7. VoidCallback? onDeleted,
  8. Color? deleteIconColor,
  9. String? deleteButtonTooltipMessage,
  10. BorderSide? side,
  11. OutlinedBorder? shape,
  12. Clip clipBehavior = Clip.none,
  13. FocusNode? focusNode,
  14. bool autofocus = false,
  15. Color? backgroundColor,
  16. EdgeInsetsGeometry? padding,
  17. VisualDensity? visualDensity,
  18. MaterialTapTargetSize? materialTapTargetSize,
  19. double? elevation,
  20. Color? shadowColor,
  21. Color? surfaceTintColor,
  22. IconThemeData? iconTheme,
  23. @Deprecated('Migrate to deleteButtonTooltipMessage. ' 'This feature was deprecated after v2.10.0-0.3.pre.') bool useDeleteButtonTooltip = true}
)

Creates a Material Design chip.

The label, autofocus, and clipBehavior arguments must not be null. The elevation must be null or non-negative.

Implementation

const Chip({
  super.key,
  this.avatar,
  required this.label,
  this.labelStyle,
  this.labelPadding,
  this.deleteIcon,
  this.onDeleted,
  this.deleteIconColor,
  this.deleteButtonTooltipMessage,
  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,
  @Deprecated(
    'Migrate to deleteButtonTooltipMessage. '
    'This feature was deprecated after v2.10.0-0.3.pre.'
  )
  this.useDeleteButtonTooltip = true,
}) : assert(label != null),
     assert(autofocus != null),
     assert(clipBehavior != null),
     assert(elevation == null || elevation >= 0.0);