convertRadix16ToInt method

int convertRadix16ToInt(
  1. List<int> list, {
  2. bool reverse = false,
})

Convert hex a decimal list to int type.

If the number is stored in big endian, pass reverse as false.

If the number is stored in little endian, pass reverse as true.

Implementation

int convertRadix16ToInt(List<int> list, {bool reverse = false}) {
  final sb = StringBuffer();
  if (reverse) {
    list = list.toList().reversed.toList();
  }

  for (final i in list) {
    sb.write(i.toRadixString(16).padLeft(2, '0'));
  }
  final numString = sb.toString();
  return int.tryParse(numString, radix: 16) ?? 0;
}