fieldTypeToEntity static method

Model fieldTypeToEntity(
  1. FieldType fieldType
)

Implementation

static Model fieldTypeToEntity(FieldType fieldType) {
  if (fieldType == FieldType.binaryField) {
    return BinaryField.empty().toModel();
  } else if (fieldType == FieldType.boolField) {
    return BoolField.empty().toModel();
  } else if (fieldType == FieldType.colorField) {
    return ColorField.empty().toModel();
  } else if (fieldType == FieldType.dateField) {
    return DateTimeField.empty().toModel();
  } else if (fieldType == FieldType.enumField) {
    return EnumField.empty().toModel();
  } else if (fieldType == FieldType.fontField) {
    return FontField.empty().toModel();
  } else if (fieldType == FieldType.headerField) {
    return HeaderField.empty().toModel();
  } else if (fieldType == FieldType.iconField) {
    return IconField.empty().toModel();
  } else if (fieldType == FieldType.idField) {
    return IdField.empty().toModel();
  } else if (fieldType == FieldType.modelsSelectorField) {
    return ModelsSelectorField.empty().toModel();
  } else if (fieldType == FieldType.stringField) {
    return StringField.empty().toModel();
  } else if (fieldType == FieldType.multiSelectorField) {
    return MultiSelectorField.empty().toModel();
  } else if (fieldType == FieldType.numberField) {
    return NumberField.empty().toModel();
  } else if (fieldType == FieldType.queryFilterField) {
    return QueryFilterField.empty().toModel();
  } else if (fieldType == FieldType.queryFilterValueField) {
    return QueryFilterValueField.empty().toModel();
  } else if (fieldType == FieldType.screenField) {
    return ScreenField.empty().toModel();
  } else if (fieldType == FieldType.selectorField) {
    return SelectorField.empty().toModel();
  } else if (fieldType == FieldType.structureField) {
    return StructureField.empty().toModel();
  } else if (fieldType == FieldType.structuredField) {
    return StructuredField.empty().toModel();
  } else if (fieldType == FieldType.dynamicField) {
    return DynamicField.empty().toModel();
  }
  // TODO(alphamikle): [FIELDS] Add new fields here
  throw Exception('Unknown field type: $fieldType');
}