toBinary method

String? toBinary({
  1. bool nullOnError = false,
})

Transform string value to binary Example: 15 => 1111

Implementation

String? toBinary({bool nullOnError = false}) {
  if (!NumUtils.isNum(this)) {
    if (nullOnError) return null;
    throw FormatException("Only accepting integer value");
  }
  return TransformUtils.toBinary(int.parse(this));
}