GroundingSupport.fromJson constructor

GroundingSupport.fromJson(
  1. Object? j
)

Implementation

factory GroundingSupport.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return GroundingSupport(
    segment: switch (json['segment']) {
      null => null,
      Object $1 => Segment.fromJson($1),
    },
    groundingChunkIndices: switch (json['groundingChunkIndices']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt(i)],
      _ => throw const FormatException(
        '"groundingChunkIndices" is not a list',
      ),
    },
    confidenceScores: switch (json['confidenceScores']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeDouble(i)],
      _ => throw const FormatException('"confidenceScores" is not a list'),
    },
  );
}