toBinary function
Converts 8-bit integer sequence to 2-bit Base-2 character sequence.
Parameters:
input
is a sequence of 8-bit integers.codec
is the Base2Codec to use. Default: Base2Codec.standard.
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);
}