isHexadecimal static method

bool isHexadecimal(
  1. String s
)

Checks if string is hexadecimal. Example: HexColor => #12F

Implementation

static bool isHexadecimal(String s) =>
    hasMatch(s, r'^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$');