Id class
An annotation to mark a field of an Entity class as the ID property.
See Id.new.
Constructors
-
Id.new({bool assignable = false})
-
Marks the field of an Entity class as its ID property. The field must be
of type int, be non-final and have not-private visibility (or a
not-private getter and setter method).
const
Properties
-
assignable
→ bool
-
When you put a new object you don't assign an ID by default, it's assigned
automatically by ObjectBox. If you need to assign IDs by yourself, use the
@Id(assignable: true) annotation. This will allow putting an object with
any valid ID. You can still set the ID to zero an leave it to ObjectBox.
Note: in case you use assignable IDs on relation targets (with ToOne
or ToMany), you're responsible for inserting new target objects before
the source. If new objects have non-zero IDs ObjectBox has no way of
telling which objects are new and which are already saved.
final
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited