Embedding.fromJson constructor

Embedding.fromJson(
  1. Object? j
)

Implementation

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