BackendServiceLogConfig.fromJson constructor

BackendServiceLogConfig.fromJson(
  1. Object? j
)

Implementation

factory BackendServiceLogConfig.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BackendServiceLogConfig(
    enable: switch (json['enable']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    loggingHttpRequestHeaders: switch (json['loggingHttpRequestHeaders']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          BackendServiceLogConfigLoggingHttpHeader.fromJson(i),
      ],
      _ => throw const FormatException(
        '"loggingHttpRequestHeaders" is not a list',
      ),
    },
    loggingHttpResponseHeaders: switch (json['loggingHttpResponseHeaders']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          BackendServiceLogConfigLoggingHttpHeader.fromJson(i),
      ],
      _ => throw const FormatException(
        '"loggingHttpResponseHeaders" is not a list',
      ),
    },
    optionalFields: switch (json['optionalFields']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"optionalFields" is not a list'),
    },
    optionalMode: switch (json['optionalMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sampleRate: switch (json['sampleRate']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
  );
}