LogMetric.fromJson constructor
LogMetric.fromJson(
- Object? j
Implementation
factory LogMetric.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return LogMetric(
name: switch (json['name']) {
null => '',
Object $1 => decodeString($1),
},
description: switch (json['description']) {
null => '',
Object $1 => decodeString($1),
},
filter: switch (json['filter']) {
null => '',
Object $1 => decodeString($1),
},
bucketName: switch (json['bucketName']) {
null => '',
Object $1 => decodeString($1),
},
disabled: switch (json['disabled']) {
null => false,
Object $1 => decodeBool($1),
},
metricDescriptor: switch (json['metricDescriptor']) {
null => null,
Object $1 => MetricDescriptor.fromJson($1),
},
valueExtractor: switch (json['valueExtractor']) {
null => '',
Object $1 => decodeString($1),
},
labelExtractors: switch (json['labelExtractors']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): decodeString(e.value),
},
_ => throw const FormatException('"labelExtractors" is not an object'),
},
bucketOptions: switch (json['bucketOptions']) {
null => null,
Object $1 => Distribution_BucketOptions.fromJson($1),
},
createTime: switch (json['createTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
updateTime: switch (json['updateTime']) {
null => null,
Object $1 => Timestamp.fromJson($1),
},
version: switch (json['version']) {
null => LogMetric_ApiVersion.$default,
Object $1 => LogMetric_ApiVersion.fromJson($1),
},
);
}