import 'package:e_scan/backend/objectbox/entities/product/product_entity.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'product_model.freezed.dart'; part 'product_model.g.dart'; @Freezed(toJson: true) abstract class ProductModel with _$ProductModel { factory ProductModel({ @Default(0) int id, String? code, String? name, String? description, String? price, String? quantity, String? image, }) = _ProductModel; factory ProductModel.fromJson(Map json) => _$ProductModelFromJson(json); } extension ProductModelExt on ProductModel { ProductEntity get toEntity => ProductEntity( id: id, name: name, description: description, price: price, quantity: quantity, image: image, ); }