Unique constructor

const Unique({
  1. ConflictStrategy onConflict = ConflictStrategy.fail,
})

Creates a unique index for a field of an Entity class.

Enforces that the value of a property is unique among all objects in a Box before an object can be put.

Trying to put an object with offending values will result in a UniqueViolationException (see ConflictStrategy.fail). Set onConflict to change this strategy.

Note: Unique properties are based on an Index, so the same restrictions apply. It is supported to explicitly add the Index annotation to configure the index.

Implementation

const Unique({this.onConflict = ConflictStrategy.fail});