fromJson static method
Returns a new SessionInit instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SessionInit? 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'id'),
'Required key "SessionInit[id]" is missing from JSON.');
assert(json[r'id'] != null,
'Required key "SessionInit[id]" has a null value in JSON.');
assert(json.containsKey(r'uuid'),
'Required key "SessionInit[uuid]" is missing from JSON.');
assert(json[r'uuid'] != null,
'Required key "SessionInit[uuid]" has a null value in JSON.');
assert(json.containsKey(r'sessionUuid'),
'Required key "SessionInit[sessionUuid]" is missing from JSON.');
assert(json[r'sessionUuid'] != null,
'Required key "SessionInit[sessionUuid]" has a null value in JSON.');
assert(json.containsKey(r'createdAt'),
'Required key "SessionInit[createdAt]" is missing from JSON.');
assert(json[r'createdAt'] != null,
'Required key "SessionInit[createdAt]" has a null value in JSON.');
assert(json.containsKey(r'createdBy'),
'Required key "SessionInit[createdBy]" is missing from JSON.');
assert(json[r'createdBy'] != null,
'Required key "SessionInit[createdBy]" has a null value in JSON.');
return true;
}());
return SessionInit(
id: mapValueOfType<int>(json, r'id')!,
uuid: mapValueOfType<String>(json, r'uuid')!,
sessionUuid: mapValueOfType<String>(json, r'sessionUuid')!,
createdAt: mapDateTime(json, r'createdAt', r'')!,
createdBy: mapValueOfType<String>(json, r'createdBy')!,
);
}
return null;
}