tryToBytes static method

BuBytes? tryToBytes(
  1. String? v
)

Like toBytes, but returns null instead of throwing (or if v is null).

Implementation

static BuBytes? tryToBytes(String? v) {
  if (v == null) return null;
  try {
    return toBytes(v);
  } catch (_) {
    return null;
  }
}