DatasetDistribution.fromJson constructor

DatasetDistribution.fromJson(
  1. Object? j
)

Implementation

factory DatasetDistribution.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return DatasetDistribution(
    sum: switch (json['sum']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    min: switch (json['min']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    max: switch (json['max']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    mean: switch (json['mean']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    median: switch (json['median']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    p5: switch (json['p5']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    p95: switch (json['p95']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    buckets: switch (json['buckets']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          DatasetDistribution_DistributionBucket.fromJson(i),
      ],
      _ => throw const FormatException('"buckets" is not a list'),
    },
  );
}