BitArray.fromUint8List constructor

BitArray.fromUint8List(
  1. int length,
  2. Uint8List list
)

Creates a bit array using a Uint8List.

Implementation

factory BitArray.fromUint8List(int length, Uint8List list) {
  if (list.lengthInBytes % 4 != 0) {
    throw FormatException('Uint8List length must be a multiplication of 4');
  }
  final data =
      list.buffer.asUint32List(list.offsetInBytes, list.lengthInBytes >> 2);
  return BitArray._(length, data);
}