printData method

List printData()

Return a List

Implementation

List<dynamic> printData() {
  List<dynamic> values = List<dynamic>.empty(growable: true);
  for (Autogenerated item in _controllers) {
    if (DynamicFormConstants.textTypes.contains(item.type)) {
      values
          .add({item.name: (item.controller as TextEditingController).text});
    }
    if (item.type == DynamicFormConstants.RADIO) {
      values.add({item.name: item.controller.toString()});
    }
    if (item.type == DynamicFormConstants.CHECKBOX) {
      List<String> checkItems = List<String>.empty(growable: true);
      for (Values value in item.values!) {
        checkItems.add(value.controller.toString());
      }
      values.add({item.name: checkItems});
    }
    if (item.type == DynamicFormConstants.SELECT) {
      values.add({item.name: item.controller.toString()});
    }
  }
  return values;
}