fromJson static method
Returns a new GemShopCustomDesignCatalogItemSchema instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static GemShopCustomDesignCatalogItemSchema? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
assert(json.containsKey(r'code'),
'Required key "GemShopCustomDesignCatalogItemSchema[code]" is missing from JSON.');
assert(json[r'code'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[code]" has a null value in JSON.');
assert(json.containsKey(r'name'),
'Required key "GemShopCustomDesignCatalogItemSchema[name]" is missing from JSON.');
assert(json[r'name'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[name]" has a null value in JSON.');
assert(json.containsKey(r'description'),
'Required key "GemShopCustomDesignCatalogItemSchema[description]" is missing from JSON.');
assert(json[r'description'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[description]" has a null value in JSON.');
assert(json.containsKey(r'price'),
'Required key "GemShopCustomDesignCatalogItemSchema[price]" is missing from JSON.');
assert(json[r'price'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[price]" has a null value in JSON.');
assert(json.containsKey(r'category'),
'Required key "GemShopCustomDesignCatalogItemSchema[category]" is missing from JSON.');
assert(json[r'category'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[category]" has a null value in JSON.');
assert(json.containsKey(r'unique_to_account'),
'Required key "GemShopCustomDesignCatalogItemSchema[unique_to_account]" is missing from JSON.');
assert(json[r'unique_to_account'] != null,
'Required key "GemShopCustomDesignCatalogItemSchema[unique_to_account]" has a null value in JSON.');
return true;
}());
return GemShopCustomDesignCatalogItemSchema(
code: mapValueOfType<String>(json, r'code')!,
name: mapValueOfType<String>(json, r'name')!,
description: mapValueOfType<String>(json, r'description')!,
price: mapValueOfType<int>(json, r'price')!,
category: GemShopCustomDesignCatalogItemSchemaCategoryEnum.fromJson(
json[r'category'])!,
uniqueToAccount: mapValueOfType<bool>(json, r'unique_to_account')!,
);
}
return null;
}