tryFromHexString static method

List<int>? tryFromHexString(
  1. String? data
)

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) {
  if (data == null) return null;
  try {
    return fromHexString(data);
  } catch (e) {
    return null;
  }
}