Measurement.fromJson constructor

Measurement.fromJson(
  1. Object? j
)

Implementation

factory Measurement.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Measurement(
    elapsedDuration: switch (json['elapsedDuration']) {
      null => null,
      Object $1 => protobuf.Duration.fromJson($1),
    },
    stepCount: switch (json['stepCount']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    metrics: switch (json['metrics']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) Measurement_Metric.fromJson(i),
      ],
      _ => throw const FormatException('"metrics" is not a list'),
    },
  );
}