IndexType enum Null safety

IndexType can be used to change what type ObjectBox uses when indexing a property.

Limits of hash/hash64 indexes: Hashes work great for equality checks, but not for "starts with" conditions. If you frequently use those, consider value indexes instead for String properties.


hash → const IndexType

Uses a 32-bit hash of the field value; default for String properties.

Hash collisions should be sporadic and shouldn't impact performance in practice. Because it requires less storage space, it's usually a better choice than hash64.

const IndexType(1)
hash64 → const IndexType

Uses a long hash of the field value to build the index. Uses more storage space than hash, thus should be used with consideration.

const IndexType(2)
value → const IndexType

Uses property values to build the index. This is a default for scalar properties.

If used for a String property, this may require more storage space than it's default, hash.

const IndexType(0)
values → const List<IndexType>

A constant List of the values in this enum, in order of their declaration.

const List<IndexType>


hashCode int
The hash code for this object. [...]
read-only, inherited
index int

The integer index of this enum.

runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


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


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