isHex static method

bool isHex(
  1. String hex
)

Sieht eine Farbangabe wie #RRGGBB aus?

Implementation

static bool isHex(String hex) {
  final h = hex.trim().replaceFirst('#', '');
  return h.length == 6 && int.tryParse(h, radix: 16) != null;
}