ResponseData.fromJson constructor
ResponseData.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ResponseData.fromJson(Map<String, dynamic> json) {
return ResponseData(
url: json['url'] as String,
status: json['status'] as int,
statusText: json['statusText'] as String,
headers: Headers.fromJson(json['headers'] as Map<String, dynamic>),
mimeType: json['mimeType'] as String,
charset: json['charset'] as String,
requestHeaders: json.containsKey('requestHeaders')
? Headers.fromJson(json['requestHeaders'] as Map<String, dynamic>)
: null,
connectionReused: json['connectionReused'] as bool? ?? false,
connectionId: json['connectionId'] as num,
remoteIPAddress: json.containsKey('remoteIPAddress')
? json['remoteIPAddress'] as String
: null,
remotePort:
json.containsKey('remotePort') ? json['remotePort'] as int : null,
fromDiskCache: json.containsKey('fromDiskCache')
? json['fromDiskCache'] as bool
: null,
fromServiceWorker: json.containsKey('fromServiceWorker')
? json['fromServiceWorker'] as bool
: null,
fromPrefetchCache: json.containsKey('fromPrefetchCache')
? json['fromPrefetchCache'] as bool
: null,
fromEarlyHints: json.containsKey('fromEarlyHints')
? json['fromEarlyHints'] as bool
: null,
serviceWorkerRouterInfo: json.containsKey('serviceWorkerRouterInfo')
? ServiceWorkerRouterInfo.fromJson(
json['serviceWorkerRouterInfo'] as Map<String, dynamic>)
: null,
encodedDataLength: json['encodedDataLength'] as num,
timing: json.containsKey('timing')
? ResourceTiming.fromJson(json['timing'] as Map<String, dynamic>)
: null,
serviceWorkerResponseSource:
json.containsKey('serviceWorkerResponseSource')
? ServiceWorkerResponseSource.fromJson(
json['serviceWorkerResponseSource'] as String)
: null,
responseTime: json.containsKey('responseTime')
? TimeSinceEpoch.fromJson(json['responseTime'] as num)
: null,
cacheStorageCacheName: json.containsKey('cacheStorageCacheName')
? json['cacheStorageCacheName'] as String
: null,
protocol:
json.containsKey('protocol') ? json['protocol'] as String : null,
alternateProtocolUsage: json.containsKey('alternateProtocolUsage')
? AlternateProtocolUsage.fromJson(
json['alternateProtocolUsage'] as String)
: null,
securityState:
security.SecurityState.fromJson(json['securityState'] as String),
securityDetails: json.containsKey('securityDetails')
? SecurityDetails.fromJson(
json['securityDetails'] as Map<String, dynamic>)
: null,
);
}