toBinary function

String toBinary(
  1. List<int> input, {
  2. Base2Codec codec = Base2Codec.standard,
})

Converts 8-bit integer sequence to 2-bit Base-2 character sequence.

Parameters:

NOTE:, This implementation is a bit-wise encoding of the input bytes. To get the numeric representation of the input in binary:

toBigInt(input).toRadixString(2)

Implementation

String toBinary(
  List<int> input, {
  Base2Codec codec = Base2Codec.standard,
}) {
  var out = codec.encoder.convert(input);
  return String.fromCharCodes(out);
}