I have a custom widget which can optionally be passed a size property. If present, this value should be passed to the size property of an Icon() widget within my own widget.
Is there a way to only pass this value if it's present?
class MyWidget extends StatelessWidget {
final double size;
MyWidget({this.size});
Widget build(BuildContext context) {
return Icon(
iconData: IconData(),
size: // Don't pass size here if not present
);
}
}