hexToB static method

int hexToB(
  1. String code
)

Implementation

static int hexToB(String code) {
  try {
    int length = code.length;
    if (length == 3) {
      var s = code.substring(2, 3);
      s += s;
      return int.parse(s, radix: 16);
    } else if (length == 6)
      return int.parse(code.substring(4, 6), radix: 16);
    else
      return int.parse(code.substring(6), radix: 16);
  } catch (e) {
    LogUtils.d("hexToB: $e");
    return 0;
  }
}