NetworkConditions.fromJson constructor

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

Implementation

factory NetworkConditions.fromJson(Map<String, dynamic> json) {
  return NetworkConditions(
    urlPattern: json['urlPattern'] as String,
    latency: json['latency'] as num,
    downloadThroughput: json['downloadThroughput'] as num,
    uploadThroughput: json['uploadThroughput'] as num,
    connectionType: json.containsKey('connectionType')
        ? ConnectionType.fromJson(json['connectionType'] as String)
        : null,
    packetLoss: json.containsKey('packetLoss')
        ? json['packetLoss'] as num
        : null,
    packetQueueLength: json.containsKey('packetQueueLength')
        ? json['packetQueueLength'] as int
        : null,
    packetReordering: json.containsKey('packetReordering')
        ? json['packetReordering'] as bool
        : null,
  );
}