ModelMonitoringNotificationSpec.fromJson constructor

ModelMonitoringNotificationSpec.fromJson(
  1. Object? j
)

Implementation

factory ModelMonitoringNotificationSpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ModelMonitoringNotificationSpec(
    emailConfig: switch (json['emailConfig']) {
      null => null,
      Object $1 => ModelMonitoringNotificationSpec_EmailConfig.fromJson($1),
    },
    enableCloudLogging: switch (json['enableCloudLogging']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    notificationChannelConfigs: switch (json['notificationChannelConfigs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          ModelMonitoringNotificationSpec_NotificationChannelConfig.fromJson(
            i,
          ),
      ],
      _ => throw const FormatException(
        '"notificationChannelConfigs" is not a list',
      ),
    },
  );
}