unpackField function

String unpackField(
  1. Variable v
)

Implementation

String unpackField(Variable v) {
  if (v.type.containsCustomType() == true) {
    if (v.type is AstMap) {
      if (v.type.maybeNull) {
        return '${v.name} == null ? null : ${Keys.mapClone}(${v.name}!)';
      }
      return '${Keys.mapClone}(${v.name})';
    } else if (v.type is AstList) {
      if (v.type.maybeNull) {
        return '${v.name} == null ? null : ${Keys.listClone}(${v.name}!)';
      }
      return '${Keys.listClone}(${v.name})';
    }
  }

  return unpackArgAST(v.type, v.name, maybeNull: v.type.maybeNull);
}