Products.fromJson constructor

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

Implementation

Products.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  title = json['title'];
  bodyHtml = json['body_html'];
  vendor = json['vendor'];
  productType = json['product_type'];
  createdAt = json['created_at'];
  handle = json['handle'];
  updatedAt = json['updated_at'];
  publishedAt = json['published_at'];
  templateSuffix = json['template_suffix'];
  status = json['status'];
  publishedScope = json['published_scope'];
  tags = json['tags'];
  adminGraphqlApiId = json['admin_graphql_api_id'];
  if (json['variants'] != null) {
    variants = [];
    json['variants'].forEach((v) {
      variants!.add(new Variants.fromJson(v));
    });
  }
  if (json['options'] != null) {
    options = [];
    json['options'].forEach((v) {
      options!.add(new Options.fromJson(v));
    });
  }
  if (json['images'] != null) {
    images = [];
    json['images'].forEach((v) {
      images!.add(new Images.fromJson(v));
    });
  }
  image = json['image'] != null ? new Images.fromJson(json['image']) : null;
}