FloatingActionButton constructor Null safety

const FloatingActionButton(
  1. {Key? key,
  2. Widget? child,
  3. String? tooltip,
  4. Color? foregroundColor,
  5. Color? backgroundColor,
  6. Color? focusColor,
  7. Color? hoverColor,
  8. Color? splashColor,
  9. Object? heroTag = const _DefaultHeroTag(),
  10. double? elevation,
  11. double? focusElevation,
  12. double? hoverElevation,
  13. double? highlightElevation,
  14. double? disabledElevation,
  15. required VoidCallback? onPressed,
  16. MouseCursor? mouseCursor,
  17. bool mini = false,
  18. ShapeBorder? shape,
  19. Clip clipBehavior = Clip.none,
  20. FocusNode? focusNode,
  21. bool autofocus = false,
  22. MaterialTapTargetSize? materialTapTargetSize,
  23. bool isExtended = false,
  24. bool? enableFeedback}
)

Creates a circular floating action button.

The mini and clipBehavior arguments must not be null. Additionally, elevation, highlightElevation, and disabledElevation (if specified) must be non-negative.

Implementation

const FloatingActionButton({
  super.key,
  this.child,
  this.tooltip,
  this.foregroundColor,
  this.backgroundColor,
  this.focusColor,
  this.hoverColor,
  this.splashColor,
  this.heroTag = const _DefaultHeroTag(),
  this.elevation,
  this.focusElevation,
  this.hoverElevation,
  this.highlightElevation,
  this.disabledElevation,
  required this.onPressed,
  this.mouseCursor,
  this.mini = false,
  this.shape,
  this.clipBehavior = Clip.none,
  this.focusNode,
  this.autofocus = false,
  this.materialTapTargetSize,
  this.isExtended = false,
  this.enableFeedback,
}) : assert(elevation == null || elevation >= 0.0),
     assert(focusElevation == null || focusElevation >= 0.0),
     assert(hoverElevation == null || hoverElevation >= 0.0),
     assert(highlightElevation == null || highlightElevation >= 0.0),
     assert(disabledElevation == null || disabledElevation >= 0.0),
     assert(mini != null),
     assert(clipBehavior != null),
     assert(isExtended != null),
     assert(autofocus != null),
     _floatingActionButtonType = mini ? _FloatingActionButtonType.small : _FloatingActionButtonType.regular,
     _extendedLabel = null,
     extendedIconLabelSpacing = null,
     extendedPadding = null,
     extendedTextStyle = null;