copyWith method
- VoidCallback? onPressed,
- ContextMenuButtonType? type,
- ContextMenuButtonKind? kind,
- String? label,
Creates a new ContextMenuButtonItem with the provided parameters overridden.
Implementation
ContextMenuButtonItem copyWith({
VoidCallback? onPressed,
ContextMenuButtonType? type,
ContextMenuButtonKind? kind,
String? label,
}) {
assert(type == null || kind == null, 'Only one of type and kind may be given.');
return ContextMenuButtonItem(
onPressed: onPressed ?? this.onPressed,
kind: kind ?? (type != null ? ContextMenuButtonKind._fromLegacyType(type) : this.kind),
label: label ?? this.label,
);
}