From 1e69bcae1f6f666879e1a345e0e90af09f8d6ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20Ma=CC=88rz?= Date: Fri, 3 Nov 2023 13:05:06 +0100 Subject: [PATCH] fix: add explicit toJson for abstract classed --- lib/src/model/answer/answer_format.dart | 6 ++++++ lib/src/model/content/content.dart | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/lib/src/model/answer/answer_format.dart b/lib/src/model/answer/answer_format.dart index c36c2411..7c789a8b 100644 --- a/lib/src/model/answer/answer_format.dart +++ b/lib/src/model/answer/answer_format.dart @@ -58,4 +58,10 @@ abstract class AnswerFormat { throw Exception('Unknown type: $type'); } } + + Map toJson() { + return { + 'type': answerType, + }; + } } diff --git a/lib/src/model/content/content.dart b/lib/src/model/content/content.dart index 7bf4d942..a561bd17 100644 --- a/lib/src/model/content/content.dart +++ b/lib/src/model/content/content.dart @@ -38,5 +38,12 @@ abstract class Content { } } + Map toJson() { + return { + 'id': id, + 'type': contentType, + }; + } + Widget createWidget(); }