toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> json = {
    'heading': heading,
    'answerType': answerType.toString(), // Assuming AnswerType is an enum
  };

  if (description != null) {
    json['description'] = description;
  }

  if (image != null) {
    json['image'] = image;
  }

  if (imageLayout != null) {
    json['imageLayout'] =
        imageLayout.toString(); // Assuming ImageLayout is an enum
  }

  if (options != null) {
    json['options'] = options;
  }

  return json;
}