valD method

String valD(
  1. String at,
  2. DartType th
)

Implementation

String valD(String at, DartType th) {
  at = at.trim();
  if (compression && at.length > 3) {
    String ds = th.getDisplayString();
    if ((ds.startsWith("Set<") ||
            ds.startsWith("Map<") ||
            ds.startsWith("List<")) &&
        (at.endsWith("}") || at.endsWith("]"))) {
      at = " $at ".replaceAll(" const ", "").trim();
      String fa = (th as InterfaceType).typeArguments[0].getDisplayString(
        withNullability: false,
      );
      registerDef(fa);
      String fa1 =
          "${applyDefsF(fa)}${th.typeArguments[0].getDisplayString(withNullability: true).endsWith("?") ? "?" : ""}";
      if (ds.startsWith("Set<")) {
        at = "<$fa1>$at";
      } else if (ds.startsWith("List<")) {
        at = "<$fa1>$at";
      } else if (ds.startsWith("Map<")) {
        String sa = th.typeArguments[1].getDisplayString(
          withNullability: false,
        );
        registerDef(sa);
        String sa1 =
            "${applyDefsF(sa)}${th.typeArguments[1].getDisplayString(withNullability: true).endsWith("?") ? "?" : ""}";
        at = "<$fa1,$sa1>$at";
      }
    }

    int? index = valDD.indexOf(at);
    if (index == -1) {
      valDD.add(at);
      index = valDD.length - 1;
    }
    return "_V[$index]";
  }

  return "$at";
}