objectbox_generator
5.3.2, released 6 months ago by objectbox.io
Generates ObjectBox binding code for annotated Dart entities.
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 bindingsAlternatives
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.
- analyzerobjectbox_generator depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlobjectbox_generator depends on itA Dart library for parsing YAML documents into Dart data structures.
- globobjectbox_generator depends on itA file and directory globbing library that supports Bash-style path matching and listing.
- dart_styleobjectbox_generator depends on itProvides an API and CLI to format Dart source code automatically.
- pubspec_parseobjectbox_generator depends on itParse pubspec.yaml files with a type‑safe API and detailed error reporting.
- buildobjectbox_generator depends on itPackage for authoring build_runner compatible code generators.
- source_genobjectbox_generator depends on itSource code generation builders and utilities for the Dart build system.
- pointycastleobjectbox_generator depends on itA Dart library providing a wide range of cryptographic algorithms and primitives.