PredictResponse.fromJson constructor

PredictResponse.fromJson(
  1. Object? j
)

Implementation

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