getColorFromHex static method

int getColorFromHex(
  1. String hex
)

Implementation

static int getColorFromHex(String hex) {
  String hexColor = hex.toUpperCase().replaceAll('#', '');
  if (hexColor.length == 6) {
    hexColor = 'FF$hexColor';
  }
  return int.parse(hexColor, radix: 16);
}