product_entity.g.dart 961 Bytes
import 'package:wow_english/generated/json/base/json_convert_content.dart';
import 'package:wow_english/models/product_entity.dart';

ProductEntity $ProductEntityFromJson(Map<String, dynamic> json) {
  final ProductEntity productEntity = ProductEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    productEntity.name = name;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    productEntity.price = price;
  }
  return productEntity;
}

Map<String, dynamic> $ProductEntityToJson(ProductEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['price'] = entity.price;
  return data;
}

extension ProductEntityExtension on ProductEntity {
  ProductEntity copyWith({
    String? name,
    double? price,
  }) {
    return ProductEntity()
      ..name = name ?? this.name
      ..price = price ?? this.price;
  }
}