toColor method
Hex color text → Color; accepts "#RGB", "#RRGGBB" and "#AARRGGBB". "#FF5722".toColor()
Implementation
Color toColor() {
String hex = replaceAll("#", "").trim();
if (hex.length == 3) hex = hex.split("").map((String c) => "$c$c").join();
if (hex.length == 6) hex = "FF$hex";
return Color(int.parse(hex, radix: 16));
}