toCodeString method

String toCodeString(
  1. String libraryPrefix
)

Convert to code string for generated code.

Implementation

String toCodeString(String libraryPrefix) {
  var code = StringBuffer("$libraryPrefix.ModelHnswParams(");
  // Note: Dart does not care about trailing commas
  code.write("dimensions: $dimensions, ");
  if (neighborsPerNode != null) {
    code.write("neighborsPerNode: $neighborsPerNode, ");
  }
  if (indexingSearchCount != null) {
    code.write("indexingSearchCount: $indexingSearchCount, ");
  }
  if (flags != null) {
    code.write("flags: $flags, ");
  }
  if (distanceType != null) {
    code.write("distanceType: $distanceType, ");
  }
  if (reparationBacklinkProbability != null) {
    code.write(
        "reparationBacklinkProbability: $reparationBacklinkProbability, ");
  }
  if (vectorCacheHintSizeKB != null) {
    code.write("vectorCacheHintSizeKB: $vectorCacheHintSizeKB, ");
  }
  code.write(")");
  return code.toString();
}