Skip to content
pubscout

rbush

1.1.1, released 3 years ago by ilya.zverev.info

High-performance Dart R-tree spatial index for points and rectangles.

WASM-ready
$ flutter pub add rbush
Source repository

What it does

Provides an in‑memory R‑tree data structure for fast 2D spatial indexing of points and rectangles. Supports bulk loading, insertion, search, removal and k‑nearest‑neighbour queries. Includes tiny queue and quick‑select utilities used internally.

AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need fast in‑memory spatial queries (e.g., map features, collision detection).
  • Bulk loading or frequent insertions with fast search performance are required.
  • You want a pure‑Dart solution that works on all Flutter platforms.

Skip it when

  • Accurate geodesic distance calculations over large geographic areas are needed.
  • Persistent or server‑side spatial indexing is required.
  • You need built‑in storage or database integration.

Strengths

  • Very fast pure‑Dart implementation.
  • Works on all Flutter platforms (mobile, web, desktop).
  • Supports bulk load and k‑nearest‑neighbour queries.

Weaknesses

  • Only in‑memory; no persistence layer.
  • Uses simple Euclidean distance, not suitable for large‑scale geographic calculations.
  • Limited to 2D indexing; no built‑in support for higher dimensions.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
final tree = RBush(16);

tree.insert(RBushElement(minX:10,minY:10,maxX:20,maxY:30,data:'sample'));

final found = tree.search(RBushBox(minX:5,minY:5,maxX:25,maxY:25));

Alternatives

Packages that do the same job and could replace rbush.

  • r_tree

    An R-tree implementation to index and query two-dimensional data in Dart.

  • liquify

    A powerful and extensible Liquid template engine for Dart.

  • serial_csv

    High-performance CSV encoder/decoder preserving types and nullability

  • jsf

    High-performance JavaScript engine plugin for Flutter with QuickJS.

Works with

Packages commonly used together with rbush: ones it builds on, ones built on it, and its own family.