toJson method

Map<String, Object?> toJson()

Serialize the entire built state to a JSON-encodable map. Used by the SQL layer to persist warmed indexes across close() / reopen.

Implementation

Map<String, Object?> toJson() {
  final n = _ids.length;
  return {
    'dim': dim,
    'metric': defaultMetric.name,
    'ids': [for (final id in _ids) id],
    'data': _encodeF32Slice(_data, 0, n * dim),
  };
}