fromJson static method
Returns a new SandboxGiveXPDataSchema instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SandboxGiveXPDataSchema? 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'cooldown'),
'Required key "SandboxGiveXPDataSchema[cooldown]" is missing from JSON.');
assert(json[r'cooldown'] != null,
'Required key "SandboxGiveXPDataSchema[cooldown]" has a null value in JSON.');
assert(json.containsKey(r'type'),
'Required key "SandboxGiveXPDataSchema[type]" is missing from JSON.');
assert(json[r'type'] != null,
'Required key "SandboxGiveXPDataSchema[type]" has a null value in JSON.');
assert(json.containsKey(r'amount'),
'Required key "SandboxGiveXPDataSchema[amount]" is missing from JSON.');
assert(json[r'amount'] != null,
'Required key "SandboxGiveXPDataSchema[amount]" has a null value in JSON.');
assert(json.containsKey(r'character'),
'Required key "SandboxGiveXPDataSchema[character]" is missing from JSON.');
assert(json[r'character'] != null,
'Required key "SandboxGiveXPDataSchema[character]" has a null value in JSON.');
return true;
}());
return SandboxGiveXPDataSchema(
cooldown: CooldownSchema.fromJson(json[r'cooldown'])!,
type: XPType.fromJson(json[r'type'])!,
amount: mapValueOfType<int>(json, r'amount')!,
character: CharacterSchema.fromJson(json[r'character'])!,
);
}
return null;
}