GroundingMetadata.fromJson constructor
GroundingMetadata.fromJson(
- Object? j
Implementation
factory GroundingMetadata.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return GroundingMetadata(
webSearchQueries: switch (json['webSearchQueries']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"webSearchQueries" is not a list'),
},
searchEntryPoint: switch (json['searchEntryPoint']) {
null => null,
Object $1 => SearchEntryPoint.fromJson($1),
},
retrievalQueries: switch (json['retrievalQueries']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"retrievalQueries" is not a list'),
},
groundingChunks: switch (json['groundingChunks']) {
null => [],
List<Object?> $1 => [for (final i in $1) GroundingChunk.fromJson(i)],
_ => throw const FormatException('"groundingChunks" is not a list'),
},
groundingSupports: switch (json['groundingSupports']) {
null => [],
List<Object?> $1 => [for (final i in $1) GroundingSupport.fromJson(i)],
_ => throw const FormatException('"groundingSupports" is not a list'),
},
retrievalMetadata: switch (json['retrievalMetadata']) {
null => null,
Object $1 => RetrievalMetadata.fromJson($1),
},
googleMapsWidgetContextToken:
switch (json['googleMapsWidgetContextToken']) {
null => null,
Object $1 => decodeString($1),
},
sourceFlaggingUris: switch (json['sourceFlaggingUris']) {
null => [],
List<Object?> $1 => [
for (final i in $1) GroundingMetadata_SourceFlaggingUri.fromJson(i),
],
_ => throw const FormatException('"sourceFlaggingUris" is not a list'),
},
);
}