Metric.fromJson constructor
Metric.fromJson(
- Object? j
Implementation
factory Metric.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return Metric(
type: switch (json['type']) {
null => '',
Object $1 => decodeString($1),
},
labels: switch (json['labels']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): decodeString(e.value),
},
_ => throw const FormatException('"labels" is not an object'),
},
);
}