fromHex method

Color fromHex()

Implementation

Color fromHex() {
  String hexColor = this;//.toString();
  hexColor = hexColor.replaceAll("#", "");
  if (hexColor.length == 6) {
    hexColor = "FF$hexColor";
  }
  if (hexColor.length == 8) {
    return Color(int.parse("0x$hexColor"));
  }
  return Color(int.parse("0xFF000000"));
}