Reputation: 35
I have colors imported from another file named colors.dart and i don't know why can't I do this now...please help
Upvotes: 3
Views: 3679
Reputation: 489
As the error message indicates, you are trying to assign a variable type Color? (which is actually Color OR null) to a list of type Color.
You can either change the declaration of the list to accept nullable values or you can make a type assertion by adding ! (only if you are sure that the value is not null.)
Like,
colors: [
rdeca!,
oranzna!
]
Upvotes: 4