fromJson static method
Returns a new GemShopSpawnEventCatalogItemSchema instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static GemShopSpawnEventCatalogItemSchema? 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 "GemShopSpawnEventCatalogItemSchema[code]" is missing from JSON.');
assert(json[r'code'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[code]" has a null value in JSON.');
assert(json.containsKey(r'name'),
'Required key "GemShopSpawnEventCatalogItemSchema[name]" is missing from JSON.');
assert(json[r'name'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[name]" has a null value in JSON.');
assert(json.containsKey(r'content_type'),
'Required key "GemShopSpawnEventCatalogItemSchema[content_type]" is missing from JSON.');
assert(json[r'content_type'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[content_type]" has a null value in JSON.');
assert(json.containsKey(r'content_code'),
'Required key "GemShopSpawnEventCatalogItemSchema[content_code]" is missing from JSON.');
assert(json[r'content_code'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[content_code]" has a null value in JSON.');
assert(json.containsKey(r'duration'),
'Required key "GemShopSpawnEventCatalogItemSchema[duration]" is missing from JSON.');
assert(json[r'duration'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[duration]" has a null value in JSON.');
assert(json.containsKey(r'price'),
'Required key "GemShopSpawnEventCatalogItemSchema[price]" is missing from JSON.');
assert(json[r'price'] != null,
'Required key "GemShopSpawnEventCatalogItemSchema[price]" has a null value in JSON.');
return true;
}());
return GemShopSpawnEventCatalogItemSchema(
code: mapValueOfType<String>(json, r'code')!,
name: mapValueOfType<String>(json, r'name')!,
contentType: MapContentType.fromJson(json[r'content_type'])!,
contentCode: mapValueOfType<String>(json, r'content_code')!,
duration: mapValueOfType<int>(json, r'duration')!,
price: mapValueOfType<int>(json, r'price')!,
);
}
return null;
}