Skip to content
pubscout

objectbox_generator

5.3.2, released 6 months ago by objectbox.io

Generates ObjectBox binding code for annotated Dart entities.

$ flutter pub add objectbox_generator
Source repository

What it does

Scans Dart files for ObjectBox annotations and creates the necessary generated code to register entities with the ObjectBox database. Integrates with build_runner to produce model files automatically.

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

Use it when

  • Using ObjectBox as the local database and want automatic model code generation
  • You need fast, ACID‑compliant local persistence with minimal manual boilerplate

Skip it when

  • You are not using ObjectBox (e.g., prefer SQLite, Hive, or Drift)
  • You want a pure‑runtime solution without a build step

Strengths

  • High‑performance, ACID‑compliant storage
  • Zero‑runtime reflection – generated code is fast
  • Seamless integration with ObjectBox Flutter package

Weaknesses

  • Works only with ObjectBox, not a generic solution
  • Requires build_runner and adds a compile‑time step
  • Limited to Dart/Flutter ecosystem

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
12

Add objectbox_generator and build_runner to dev_dependencies, run flutter pub run build_runner build to generate code

import 'package:objectbox/objectbox.dart';

@Entity()
class Person {
  int id = 0;
  String name;

  Person(this.name);
}

// Run build_runner to generate objectbox.g.dart with ObjectBox bindings

Alternatives

Packages that do the same job and could replace objectbox_generator.

Works with

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