local_hnsw
1.0.0, released 2 years ago by an unverified publisher
A lightweight, in-memory HNSW vector index for Dart and Flutter supporting fast ANN search.
WASM-readyUnverified publisher
What it does
Provides an in-memory vector index for performing fast approximate nearest neighbor searches using cosine or Euclidean similarity. Allows adding, searching, deleting, saving, and loading vectors natively in Dart.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need on-device vector search or embeddings matching in Dart or Flutter
- You want a pure Dart implementation without native dependencies
- You need to save and load small vector indices locally
Skip it when
- You require a persistent embedded database for massive enterprise-scale vector collections
- You need complex vector filtering that goes beyond basic distance metrics
Strengths
- Pure Dart implementation with no native dependencies
- Supports both cosine and Euclidean similarity metrics
- Includes built-in save and load serialization methods
Weaknesses
- In-memory storage means indices must be serialized and reloaded for persistence
- Not documented for scaling to millions of high-dimensional vectors compared to specialized native vector databases
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
No native setup or dependencies required.
final index = LocalHNSW<String>(
dim: 3,
metric: LocalHnswMetric.cosine,
);
index.add(LocalHnswItem(item: 'apple', vector: [0.1, 0.2, 0.3]));
final result = index.search([0.1, 0.2, 0.3], 2);