add0x static method

String add0x(
  1. String value
)

add the '0x' prefix to a hexadecimal string if it exists.

Implementation

static String add0x(String value) {
  if (value.toLowerCase().startsWith("0x")) {
    return value;
  }
  return "0x$value";
}