hexToDecimal function

int hexToDecimal(
  1. String hex
)

Implementation

int hexToDecimal(String hex) {
  int decimal = 0;
  for (int i = 0; i < hex.length; i++) {
    int digit = int.parse(hex[i], radix: 16);
    decimal += digit * pow(16, hex.length - i - 1).toInt();
  }
  return decimal;
}