Reputation: 483
here is the declaration of 'colour' final Colors colour;
this is the method/constructor where I will be receiving a color from my main.dart
MyCardState(
myQuestion: myQuestion,
myColor: colour,
opA: myOptionA,
opB: myOptionB
)
But I have no idea how to send a color from my main.dart. I tried colour: Colors.cyan
but it won't work.
Upvotes: 2
Views: 5266
Reputation: 483
problem solved I was supposed to use final Color colour
instead of final Colors colour
Upvotes: 0
Reputation: 977
You should use the class Color, in singular:
class MyCardState {
final Color color;
MyCardState({this.color});
}
Also, keep in mind that some colors in Colors.*
are instances of MaterialColor and not Color.
Upvotes: 6