StrategyLeastLoadConfig.fromJson constructor

StrategyLeastLoadConfig.fromJson(
  1. Object? json
)

Implementation

factory StrategyLeastLoadConfig.fromJson(Object? json) {
  final map = asJsonMap(json, 'leastload strategy');
  return StrategyLeastLoadConfig(
    costs: map['costs'] == null
        ? null
        : asJsonList(map['costs'], StrategyWeight.fromJson),
    baselines: map['baselines'] == null
        ? null
        : asJsonList(map['baselines'], XrayDuration.fromJson),
    expected: map['expected'] as int?,
    maxRTT: map['maxRTT'] == null
        ? null
        : XrayDuration.fromJson(map['maxRTT']),
    tolerance: (map['tolerance'] as num?)?.toDouble(),
  );
}