There’s a weird error saying that The argument type ‘Color?’ can’t be assigned to the parameter type ‘Color’ when I try to assign the color, what is going on here?
you can not assign double value to the color as you have defined color property of double data type.Change the data type of color to the Color like this:
final Color color;
if you wan to use hex color code you can do it like this
3
Answers
You can use
Theme.of(context)
to get the color(and other property).And try not to use
!
without null check.color datatype is Color?
please change the double datatype to Color?
you can not assign double value to the color as you have defined color property of double data type.Change the data type of color to the
Color
like this:if you wan to use hex color code you can do it like this
in this the b74093 is the hex code of the color.