add method

void add(
  1. String item
)

Adds an item to the filter.

After this call, mightContain(item) is guaranteed to return true.

Implementation

void add(String item) {
  if (isEmpty) return;
  final hashes = _computeHashes(item);
  for (final h in hashes) {
    final bitIndex = h % _bitCount;
    _bits[bitIndex ~/ 8] |= (1 << (bitIndex % 8));
  }
}