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