toJson method

Map<String, dynamic> toJson()

Converte in JSON

Implementation

Map<String, dynamic> toJson() {
  String typeString;
  if (type == String) {
    typeString = 'String';
  } else if (type == int) {
    typeString = 'int';
  } else if (type == double) {
    typeString = 'double';
  } else if (type == bool) {
    typeString = 'bool';
  } else if (type == DateTime) {
    typeString = 'DateTime';
  } else {
    typeString = type.toString();
  }

  return {
    'name': name,
    'displayName': displayName,
    'type': typeString,
    'isRequired': isRequired,
    'defaultValue': defaultValue,
    'validationRules': validationRules,
    'description': description,
    'metadata': metadata,
  };
}