Is it possible to convert value of Material Color to Hex Code in flutter, I have been trying for a while now but i just cant work around it. any help would be appreciated.
3 Answers
There is a utils package that contains a ColorUtils class that can convert hex to int and int to hex. That can be used to create the Flutter colors or a HEX value from the Flutter color.
Github: https://github.com/Ephenodrom/Dart-Basic-Utils
PuDev: https://pub.dev/packages/basic_utils
Install :
basic_utils: ^2.0.0
Example :
Color color = Color(ColorUtils.hexToInt("#FFFFFF"));
String hex = ColorUtils.intToHex(color.value);
1 Comment
Abion47
You shouldn't use a package for functionality that exists in Dart by itself.