ServiceWorkerVersion.fromJson constructor

ServiceWorkerVersion.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ServiceWorkerVersion.fromJson(Map<String, dynamic> json) {
  return ServiceWorkerVersion(
    versionId: json['versionId'] as String,
    registrationId: RegistrationID.fromJson(json['registrationId'] as String),
    scriptURL: json['scriptURL'] as String,
    runningStatus: ServiceWorkerVersionRunningStatus.fromJson(
        json['runningStatus'] as String),
    status: ServiceWorkerVersionStatus.fromJson(json['status'] as String),
    scriptLastModified: json.containsKey('scriptLastModified')
        ? json['scriptLastModified'] as num
        : null,
    scriptResponseTime: json.containsKey('scriptResponseTime')
        ? json['scriptResponseTime'] as num
        : null,
    controlledClients: json.containsKey('controlledClients')
        ? (json['controlledClients'] as List)
            .map((e) => target.TargetID.fromJson(e as String))
            .toList()
        : null,
    targetId: json.containsKey('targetId')
        ? target.TargetID.fromJson(json['targetId'] as String)
        : null,
    routerRules: json.containsKey('routerRules')
        ? json['routerRules'] as String
        : null,
  );
}