Feature.fromJson constructor

Feature.fromJson(
  1. Object? j
)

Implementation

factory Feature.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Feature(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    valueType: switch (json['valueType']) {
      null => Feature_ValueType.$default,
      Object $1 => Feature_ValueType.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($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'),
    },
    etag: switch (json['etag']) {
      null => '',
      Object $1 => decodeString($1),
    },
    monitoringConfig: switch (json['monitoringConfig']) {
      null => null,
      Object $1 => FeaturestoreMonitoringConfig.fromJson($1),
    },
    disableMonitoring: switch (json['disableMonitoring']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    monitoringStats: switch (json['monitoringStats']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FeatureStatsAnomaly.fromJson(i),
      ],
      _ => throw const FormatException('"monitoringStats" is not a list'),
    },
    monitoringStatsAnomalies: switch (json['monitoringStatsAnomalies']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) Feature_MonitoringStatsAnomaly.fromJson(i),
      ],
      _ => throw const FormatException(
        '"monitoringStatsAnomalies" is not a list',
      ),
    },
    featureStatsAndAnomaly: switch (json['featureStatsAndAnomaly']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FeatureStatsAndAnomaly.fromJson(i),
      ],
      _ => throw const FormatException(
        '"featureStatsAndAnomaly" is not a list',
      ),
    },
    versionColumnName: switch (json['versionColumnName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    pointOfContact: switch (json['pointOfContact']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}