isExistingItem method
Checks if an item with the given ID exists in the local database. This is a placeholder and should be overridden by concrete repositories.
Implementation
@protected
Future<bool> isExistingItem(T item) async {
// Default implementation, should be overridden.
// For safety, assume item doesn't exist if not overridden,
// to avoid accidental updates if create was intended.
// However, a more robust approach is to require override or have a clear
// contract on how newness is determined (e.g., model has an isNew flag).
// For now, let's log and return false.
log.warning(
'isExistingItem() not implemented for $T with id ${item.id}, '
'assuming false (new item).',
);
final existing = await fetchFromLocal(item.id, queryParams: null);
return existing != null;
}