argbFromHex function

int? argbFromHex(
  1. String hex
)

Implementation

int? argbFromHex(String hex) {
  hex = hex.replaceAll('#', '');
  if (hex.length == 6) {
    hex = 'FF$hex'; // add alpha if it's missing
  }
  return int.tryParse(hex, radix: 16);
}