bit_array 2.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Bit array implementation in Dart #

A bit array (also known as BitMap, BitSet, BitString, or BitVector) is an array data structure that compactly stores bits.

Usage #

A simple usage example:

import 'package:bit_array/bit_array.dart';

main() {
  final array = new FixedBitArray(1024);
  array[12] = true;
  array.setBit(123);
  array.invertBit(200);
  array.clearBit(12);
  print(array.asIntIterable().toList()); // prints [123, 200]

  final other = new FixedBitArray(1024);
  other[123] = true;

  final and = array & other;
  print(and.asIntIterable().toList()); // prints [123]
}

2.0.0 #

BREAKING CHANGES

  • Changed internal 64-bit int storage to 32-bit ints to be able to run in browsers.
  • asUint32Iterable instead of asUint64Iterable

1.2.0 #

  • Counter multiplication can be done with operator *.
  • Support of masking counter (with threshold value).
  • Support of efficient min and max operations in counters.

1.1.0 #

  • CompositeSet.clone returns CompositeSet.
  • Support shiftLeft in many operations.
  • Support multiply and clone of counters.
  • Use package:pedantic and Dart 2.2 features.

1.0.1 #

  • asUint64Iterable() added to provide interface-level compatibility for future compressed bit arrays.
  • BitSet to have a non-bitarray backed interface (eg. compressed structures).
  • CompositeSet and CompositeCounter for arbitrary-large compressed bitmap operations.

1.0.0 #

  • Initial version.

example/example.dart

import 'package:bit_array/bit_array.dart';

main() {
  final array = BitArray(1024);
  array[12] = true;
  array.setBit(123);
  array.invertBit(200);
  array.clearBit(12);
  print(array.asIntIterable().toList()); // prints [123, 200]

  final other = BitArray(1024);
  other[123] = true;

  final and = array & other;
  print(and.asIntIterable().toList()); // prints [123]
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  bit_array: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:bit_array/bit_array.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Nov 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:bit_array/bit_array.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0