when identifying an variable color in the class and I cant use it in flutter what's the the wrong?
when identifying an variable color in the class and I cant use it in flutter what's the the wrong?
CodePudding user response:
Colors.white
is a type of MaterialColor
not Color
.
Change your variable declaration to MaterialColor backColor = Colors.white
, or even better, just write final backColor = Colors.white
.
CodePudding user response:
There's a key difference between a materialColor and Color..
https://elifent.tech/blog/what-is-difference-between-materialcolor-and-color-in-flutter
change your variable to: Color backColor = const Color(0xFFFFFFFF);
have a read.. do upvote if helpful