setterCodeForField function

String setterCodeForField (FieldElement field, { bool private: true })

Implementation

String setterCodeForField(FieldElement field, {bool private = true}) {
  var code = null;
  switch (field.type.displayName) {
    case 'bool':
      code = '${private ? '_' : ''}adapter.setBool("${field.name}", value);';
      break;
    case 'int':
      code = '${private ? '_' : ''}adapter.setInt("${field.name}", value);';
      break;
    case 'String':
      code = '${private ? '_' : ''}adapter.setString("${field.name}", value);';
      break;
    case 'List<String>':
      code =
          '${private ? '_' : ''}adapter.setStringList("${field.name}", value);';
      break;
    case 'double':
      code = '${private ? '_' : ''}adapter.setDouble("${field.name}", value);';
      break;
  }
  return code;
}