tryFromHexString static method

List<int>? tryFromHexString(
  1. String? data, {
  2. bool paddingZero = false,
})

Tries to convert a hexadecimal string data into a List of integers.

If data is null, returns null. Otherwise, attempts to parse the hexadecimal string using the fromHexString function. If successful, returns the resulting List of integers; otherwise, returns null.

Implementation

static List<int>? tryFromHexString(String? data, {bool paddingZero = false}) {
  if (data == null) return null;
  try {
    return fromHexString(data, paddingZero: paddingZero);
  } catch (e) {
    return null;
  }
}