Since color.value
is deprecated in Flutter 2.17,
Colors.red.value,
gives 'value' is deprecated and shouldn't be used. Use component accessors like .r or .g.
.
How do you get HEX value of a color? Not only green, red or blue values but HEX value?
int get value {
return _floatToInt8(a) << 24 |
_floatToInt8(r) << 16 |
_floatToInt8(g) << 8 |
_floatToInt8(b) << 0;
}
Should we now write this depricated method ourselves or is there better way?
2
Answers
There will be a replacement method
toARGB32()
in the next version. Until then you can use the deprecated getter or re-implement it. I would just wait untiltoARGB32()
makes it into the stable Flutter version.