I\'m converting a project to Kotlin and I\'m trying to make my model (which is also my entity) a data class I intend to use Moshi to convert the JSON responses from the API<
Like it's said in the Room docs, you are required to make an empty public constructor. At the same time, if you want to declare other custom constructors, you must add @Ignore annotation.
@Entity
public class CartItem {
@PrimaryKey
public int product_id;
public int qty;
public CartItem() {
}
@Ignore
public CartItem(int product_id, int count) {
this.product_id = product_id;
this.qty = count;
}
}