Unique class
Unique constraint annotation for single or multiple columns
Can be used on a field for single-column unique constraint, or on the entity class for composite unique constraints.
Example:
// Single column unique
@Unique()
String email;
// Composite unique on entity class
@Entity(tableName: 'user_roles')
@Unique(columns: ['user_id', 'role_id'], name: 'uq_user_role')
class UserRoleEntity { ... }
Properties
-
columns
→ List<
String> ? -
List of column names for composite unique constraint
Leave empty when used on a single field
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
Optional name for the unique constraint
final
- 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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited