error Error:
The argument type 'List?' can't be assigned to the parameter type 'List' because 'List?' is nullable and 'List
CodePudding user response:
alarm.gradientColors
is not guaranteed to be not null
. If it can never be null
you shouldn't define it as nullable. If it should be nullable but you are sure it's not null
at that point of code, just add an !
behind it like:
colors: alarm.gradientColors!
CodePudding user response:
I will encourage to do a null check before using !
or just provide default value on null cases like
colors: alarm.gradientColors?? [Colors.red,Colors.blue], //default color