tryToBytes static method

List<int>? tryToBytes(
  1. String? v
)

Implementation

static List<int>? tryToBytes(String? v) {
  if (v == null) return null;
  try {
    if (isHexBytes(v)) {
      return BytesUtils.fromHexString(v);
    } else {
      return encode(v);
    }
  } catch (e) {
    return null;
  }
}