Entity class Null safety

Entity annotation is used on a class to let ObjectBox know it should store it - making the class a "persistable Entity".

This annotation is matched by ObjectBox code generator when you call pub run_build_runner build. The generator creates objectbox.g.dart with all the binding code necessary to store the class in the database.

Constructors

Entity({int? uid, Type? realClass})
Create an Entity annotation.
const

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
realClass Type?
Actual type this entity represents. ObjectBox will use it instead of the @Entity()-annotated class's name. For example: [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
uid int?
ObjectBox keeps track of entities and properties by assigning them unique identifiers, UIDs, during the code-generation phase. All those UIDs are stored in a file objectbox-model.json in your package and are looked up by name. If the name changes a new uid is assigned, effectively creating a new Entity in the database. [...]
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited