PopupMenuButton<T> constructor Null safety

const PopupMenuButton<T>(
  1. {Key? key,
  2. required PopupMenuItemBuilder<T> itemBuilder,
  3. T? initialValue,
  4. PopupMenuItemSelected<T>? onSelected,
  5. PopupMenuCanceled? onCanceled,
  6. String? tooltip,
  7. double? elevation,
  8. EdgeInsetsGeometry padding,
  9. Widget? child,
  10. Widget? icon,
  11. double? iconSize,
  12. Offset offset,
  13. bool enabled,
  14. ShapeBorder? shape,
  15. Color? color,
  16. bool? enableFeedback}
)

Creates a button that shows a popup menu.

The itemBuilder argument must not be null.

Implementation

const PopupMenuButton({
  Key? key,
  required this.itemBuilder,
  this.initialValue,
  this.onSelected,
  this.onCanceled,
  this.tooltip,
  this.elevation,
  this.padding = const EdgeInsets.all(8.0),
  this.child,
  this.icon,
  this.iconSize,
  this.offset = Offset.zero,
  this.enabled = true,
  this.shape,
  this.color,
  this.enableFeedback,
}) : assert(itemBuilder != null),
     assert(offset != null),
     assert(enabled != null),
     assert(
       !(child != null && icon != null),
       'You can only pass [child] or [icon], not both.',
     ),
     super(key: key);