Box<T> class

A box to store objects of a particular class.

Constructors

Box(Store _store)

Properties

ptr → Pointer<Void>
The low-level pointer to this box.
read-only
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

contains(int id) → bool
Returns true if this box contains an Object with the ID id.
containsMany(List<int> ids) → bool
Returns true if this box contains objects with all of the given ids using a single transaction.
count({int limit: 0}) → int
Returns the count of all stored Objects in this box or, if limit is not zero, the given limit, whichever is lower.
get(int id) → T
Retrieves the stored object with the ID id from this box's database. Returns null if not found.
getAll() → List<T>
Returns all stored objects in this Box.
getMany(List<int> ids) → List<T>
Returns a list of ids.length Objects of type T, each corresponding to the location of its ID in ids. Non-existent IDs become null.
isEmpty() → bool
Returns true if no objects are in this box.
put(T object, {_PutMode mode: _PutMode.Put}) → int
Puts the given Object in the box (aka persisting it). If this is a new entity (its ID property is 0), a new ID will be assigned to the entity (and returned). If the entity was already put in the box before, it will be overwritten. [...]
putMany(List<T> objects, {_PutMode mode: _PutMode.Put}) → List<int>
Puts the given objects into this Box in a single transaction. Returns a list of all IDs of the inserted Objects.
query(Condition qc) QueryBuilder
Returns a builder to create queries for Object matching supplied criteria.
remove(int id) → bool
Removes (deletes) the Object with the ID id. Returns true if an entity was actually removed and false if no entity exists with the given ID.
removeAll() → int
Removes (deletes) ALL Objects in a single transaction.
removeMany(List<int> ids) → int
Removes (deletes) Objects by their ID in a single transaction. Returns a list of IDs of all removed Objects.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

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