getDefaultValueByType function

String getDefaultValueByType(
  1. String type,
  2. String className
)

Implementation

String getDefaultValueByType(String type,String className){
  if (type == 'bool') {
    return 'false';
  }else if (type == 'num') {
    return '0';
  }else if (type == 'String') {
    return "\"\"";
  }else if (type == "List") {
    return 'List.empty()';
  }else if (type.contains("Map<")) {
    return 'Map<String,dynamic>()';
  }else if (type.contains("List<")) {
    return 'List.empty()';
  }
  return "";
}