I'm getting an error when assigning a default value to an instance variable of the type Color. I'm getting this error only when I assign colors with their shade value.
Error: The default value of an optional parameter must be constant.
class CardPanelHeader extends StatelessWidget {
final String leadingPanelText;
final Color leadingPanelTextColor;
final String trailingPanelText;
final Color trailingPanelTextColor;
const CardPanelHeader({
Key key,
this.leadingPanelText,
this.leadingPanelTextColor = Colors.black87,
this.trailingPanelText,
this.trailingPanelTextColor = Colors.grey.shade600,
}) : super(key: key);
I did check this solution but didn't work for me.
Could anyone please help me with this. Thanks in advance!