updateSync method

  1. @override
void updateSync(
  1. ItemWithId input
)
override

Updates an existing item in the database.

Throws ItemNotFoundException if the item does not exist.

Implementation

@override
void updateSync(ItemWithId input) {
  final path = _getItemPath(input.toItemId());
  NamingConvention.validateOrThrow(path);
  if (!_workDbInternalSync.existSync(path)) {
    throw ItemNotFoundException(id: input.id, collection: input.collection);
  }
  _workDbInternalSync.writeFileSync(path, Item(item: input.item));
}