fromJson static method
Returns a new SpatioCall instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SpatioCall? 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 "SpatioCall[id]" is missing from JSON.');
assert(json[r'id'] != null, 'Required key "SpatioCall[id]" has a null value in JSON.');
return true;
}());
return SpatioCall(
id: mapValueOfType<String>(json, r'id')!,
title: mapValueOfType<String>(json, r'title'),
status: mapValueOfType<String>(json, r'status'),
hostUserId: mapValueOfType<String>(json, r'hostUserId'),
workspaceId: mapValueOfType<String>(json, r'workspaceId'),
roomId: mapValueOfType<String>(json, r'roomId'),
participants: Map.listFromJson(json[r'participants']),
metadata: mapCastOfType<String, Object>(json, r'metadata') ?? const {},
startedAt: mapDateTime(json, r'startedAt', r''),
endedAt: mapDateTime(json, r'endedAt', r''),
createdAt: mapDateTime(json, r'createdAt', r''),
);
}
return null;
}