MonitoredResource.fromJson constructor

MonitoredResource.fromJson(
  1. Object? j
)

Implementation

factory MonitoredResource.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return MonitoredResource(
    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'),
    },
  );
}