fromJson static method
Implementation
static Session fromJson(dynamic json) {
dynamic jsonData = json;
try {
String jsonDataString = json.toString();
jsonData = jsonDecode(jsonDataString);
} catch (e) {
jsonData = json;
}
var widgetUserAgentJson = jsonData['widgetUserAgent'];
var riskAnalyticsJson = jsonData['riskAnalytics'];
WidgetUserAgent? widgetUserAgent;
RiskAnalytics? riskAnalytics;
if (widgetUserAgentJson != null) {
widgetUserAgent = WidgetUserAgent.fromJson(widgetUserAgentJson);
}
if (riskAnalyticsJson != null) {
riskAnalytics = RiskAnalytics.fromJson(riskAnalyticsJson);
}
return Session(
jsonData['widgetOrigin'] as String?,
jsonData['sessionId'] as String,
widgetUserAgent,
jsonData['iPAddressMobile'] as String? ?? '',
jsonData['iPAddressWidget'] as String? ?? '',
riskAnalytics,
jsonData['publicUserId'] as String?,
);
}