NearestNeighbors.fromJson constructor

NearestNeighbors.fromJson(
  1. Object? j
)

Implementation

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