dart - How to convert Flutter color to string and back to a color - Stack Overflow

PHOTO EMBED

Mon Oct 26 2020 01:08:55 GMT+0000 (UTC)

Saved by @rdemo #dart

Color color = new Color(0x12345678);
String colorString = color.toString(); // Color(0x12345678)
String valueString = colorString.split('(0x')[1].split(')')[0]; // kind of hacky..
int value = int.parse(valueString, radix: 16);
Color otherColor = new Color(value);
content_copyCOPY

https://stackoverflow.com/questions/49835146/how-to-convert-flutter-color-to-string-and-back-to-a-color