ExamplesOverride.fromJson constructor

ExamplesOverride.fromJson(
  1. Object? j
)

Implementation

factory ExamplesOverride.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ExamplesOverride(
    neighborCount: switch (json['neighborCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    crowdingCount: switch (json['crowdingCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    restrictions: switch (json['restrictions']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ExamplesRestrictionsNamespace.fromJson(i),
      ],
      _ => throw const FormatException('"restrictions" is not a list'),
    },
    returnEmbeddings: switch (json['returnEmbeddings']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    dataFormat: switch (json['dataFormat']) {
      null => ExamplesOverride_DataFormat.$default,
      Object $1 => ExamplesOverride_DataFormat.fromJson($1),
    },
  );
}