ItemAlreadyExistsException class
Exception thrown when trying to create an item that already exists.
This exception is thrown by IWorkDb.create when an item with the same id already exists in the specified collection.
Example:
try {
await db.create(ItemWithId(id: 'user-1', collection: 'users', item: {}));
await db.create(ItemWithId(id: 'user-1', collection: 'users', item: {}));
} on ItemAlreadyExistsException catch (e) {
print('Item ${e.id} already exists in ${e.collection}');
}
- Implemented types
Constructors
- ItemAlreadyExistsException({required String id, required String collection})
-
Creates a new ItemAlreadyExistsException.
const
Properties
- collection → String
-
The collection where the item exists.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The id of the item that already exists.
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.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited