NearestNeighborQuery.fromJson constructor

NearestNeighborQuery.fromJson(
  1. Object? j
)

Implementation

factory NearestNeighborQuery.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return NearestNeighborQuery(
    entityId: switch (json['entityId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    embedding: switch (json['embedding']) {
      null => null,
      Object $1 => NearestNeighborQuery_Embedding.fromJson($1),
    },
    neighborCount: switch (json['neighborCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    stringFilters: switch (json['stringFilters']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) NearestNeighborQuery_StringFilter.fromJson(i),
      ],
      _ => throw const FormatException('"stringFilters" is not a list'),
    },
    numericFilters: switch (json['numericFilters']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) NearestNeighborQuery_NumericFilter.fromJson(i),
      ],
      _ => throw const FormatException('"numericFilters" is not a list'),
    },
    perCrowdingAttributeNeighborCount:
        switch (json['perCrowdingAttributeNeighborCount']) {
          null => 0,
          Object $1 => decodeInt($1),
        },
    parameters: switch (json['parameters']) {
      null => null,
      Object $1 => NearestNeighborQuery_Parameters.fromJson($1),
    },
  );
}