The purpose of my code is to supply the primary colour to the super widget when no colour was provided in the call.
But doing that makes this error to fire:
FlutterError (dependOnInheritedWidgetOfExactType<_InheritedTheme>() or dependOnInheritedElement() was called before _BottomDrawerWidgetState.initState() completed.
class BottomDrawerChip extends RadarChip {
BottomDrawerChip(
BuildContext context, {
required dynamic label,
super.onTap,
super.prefix,
super.caption,
super.color,
super.padding,
}) : super(
// color: color ?? Theme.of(context).colorScheme.primary,// TODO: make sure the color is initialized with primary
label: label is String ? " $label" : label,
margin: EdgeInsets.only(right: ThemeModel.contentPadding / 4),
);
As the super’s color is final, there is no setter and therefore I cannot use the constructor body to make the assignment.
How can I do it?