hexToR static method

int hexToR(
  1. String code
)

Implementation

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