GenerateContentResponse_PromptFeedback.fromJson constructor

GenerateContentResponse_PromptFeedback.fromJson(
  1. Object? j
)

Implementation

factory GenerateContentResponse_PromptFeedback.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return GenerateContentResponse_PromptFeedback(
    blockReason: switch (json['blockReason']) {
      null => GenerateContentResponse_PromptFeedback_BlockReason.$default,
      Object $1 =>
        GenerateContentResponse_PromptFeedback_BlockReason.fromJson($1),
    },
    safetyRatings: switch (json['safetyRatings']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) SafetyRating.fromJson(i)],
      _ => throw const FormatException('"safetyRatings" is not a list'),
    },
  );
}