fromJson static method
Returns a new GemShopCatalogDataSchema instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static GemShopCatalogDataSchema? 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'skins'),
'Required key "GemShopCatalogDataSchema[skins]" is missing from JSON.');
assert(json[r'skins'] != null,
'Required key "GemShopCatalogDataSchema[skins]" has a null value in JSON.');
assert(json.containsKey(r'spawn_events'),
'Required key "GemShopCatalogDataSchema[spawn_events]" is missing from JSON.');
assert(json[r'spawn_events'] != null,
'Required key "GemShopCatalogDataSchema[spawn_events]" has a null value in JSON.');
assert(json.containsKey(r'subscriptions'),
'Required key "GemShopCatalogDataSchema[subscriptions]" is missing from JSON.');
assert(json[r'subscriptions'] != null,
'Required key "GemShopCatalogDataSchema[subscriptions]" has a null value in JSON.');
assert(json.containsKey(r'custom_designs'),
'Required key "GemShopCatalogDataSchema[custom_designs]" is missing from JSON.');
assert(json[r'custom_designs'] != null,
'Required key "GemShopCatalogDataSchema[custom_designs]" has a null value in JSON.');
return true;
}());
return GemShopCatalogDataSchema(
skins: GemShopSkinCatalogItemSchema.listFromJson(json[r'skins']),
spawnEvents: GemShopSpawnEventCatalogItemSchema.listFromJson(
json[r'spawn_events']),
subscriptions: GemShopSubscriptionCatalogItemSchema.listFromJson(
json[r'subscriptions']),
customDesigns: GemShopCustomDesignCatalogItemSchema.listFromJson(
json[r'custom_designs']),
);
}
return null;
}