import 'package:wow_english/generated/json/base/json_convert_content.dart'; import 'package:wow_english/models/product_entity.dart'; ProductEntity $ProductEntityFromJson(Map json) { final ProductEntity productEntity = ProductEntity(); final int? id = jsonConvert.convert(json['id']); if (id != null) { productEntity.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { productEntity.name = name; } final String? title = jsonConvert.convert(json['title']); if (title != null) { productEntity.title = title; } final double? price = jsonConvert.convert(json['price']); if (price != null) { productEntity.price = price; } final String? picUrl = jsonConvert.convert(json['picUrl']); if (picUrl != null) { productEntity.picUrl = picUrl; } final String? bannerPicUrl = jsonConvert.convert( json['bannerPicUrl']); if (bannerPicUrl != null) { productEntity.bannerPicUrl = bannerPicUrl; } final String? detailPicUrl = jsonConvert.convert( json['detailPicUrl']); if (detailPicUrl != null) { productEntity.detailPicUrl = detailPicUrl; } final int? saleType = jsonConvert.convert(json['saleType']); if (saleType != null) { productEntity.saleType = saleType; } final int? status = jsonConvert.convert(json['status']); if (status != null) { productEntity.status = status; } final int? sortOrder = jsonConvert.convert(json['sortOrder']); if (sortOrder != null) { productEntity.sortOrder = sortOrder; } final int? validityType = jsonConvert.convert(json['validityType']); if (validityType != null) { productEntity.validityType = validityType; } return productEntity; } Map $ProductEntityToJson(ProductEntity entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['title'] = entity.title; data['price'] = entity.price; data['picUrl'] = entity.picUrl; data['bannerPicUrl'] = entity.bannerPicUrl; data['detailPicUrl'] = entity.detailPicUrl; data['saleType'] = entity.saleType; data['status'] = entity.status; data['sortOrder'] = entity.sortOrder; data['validityType'] = entity.validityType; return data; } extension ProductEntityExtension on ProductEntity { ProductEntity copyWith({ int? id, String? name, String? title, double? price, String? picUrl, String? bannerPicUrl, String? detailPicUrl, int? saleType, int? status, int? sortOrder, int? validityType, }) { return ProductEntity() ..id = id ?? this.id ..name = name ?? this.name ..title = title ?? this.title ..price = price ?? this.price ..picUrl = picUrl ?? this.picUrl ..bannerPicUrl = bannerPicUrl ?? this.bannerPicUrl ..detailPicUrl = detailPicUrl ?? this.detailPicUrl ..saleType = saleType ?? this.saleType ..status = status ?? this.status ..sortOrder = sortOrder ?? this.sortOrder ..validityType = validityType ?? this.validityType; } }