VertexAisearch.fromJson constructor

VertexAisearch.fromJson(
  1. Object? j
)

Implementation

factory VertexAisearch.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return VertexAisearch(
    datastore: switch (json['datastore']) {
      null => '',
      Object $1 => decodeString($1),
    },
    engine: switch (json['engine']) {
      null => '',
      Object $1 => decodeString($1),
    },
    maxResults: switch (json['maxResults']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    filter: switch (json['filter']) {
      null => '',
      Object $1 => decodeString($1),
    },
    dataStoreSpecs: switch (json['dataStoreSpecs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) VertexAisearch_DataStoreSpec.fromJson(i),
      ],
      _ => throw const FormatException('"dataStoreSpecs" is not a list'),
    },
  );
}