CategoryDTO.fromJson constructor

CategoryDTO.fromJson(
  1. Map<String, dynamic> json
)

Implementation

CategoryDTO.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
  name = json['name'];
  slug = json['slug'];
  sortIndex = json['sortIndex'];
  if (json['photos'] != null) {
    photos = <PhotoDTO>[];
    json['photos'].forEach((v) {
      photos!.add(PhotoDTO.fromJson(v));
    });
  }
  store = json['store'] != null ? StoreDTO.fromJson(json['store']) : null;
  tax = json['tax'];
  if (json['children'] != null) {
    children = <CategoryDTO>[];
    json['children'].forEach((v) {
      children!.add(CategoryDTO.fromJson(v));
    });
  }
}