1. Import
This commit is contained in:
commit
cb4525a774
165 files changed
+14763
No files matched your search
@@ -0,0 +1,104 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/model/short_poll_question.dart';
|
||||
|
||||
part 'short_poll.g.dart';
|
||||
|
||||
@collection
|
||||
class ShortPoll {
|
||||
late Id id;
|
||||
|
||||
late int type;
|
||||
|
||||
late String text;
|
||||
|
||||
late String title;
|
||||
|
||||
late int validFrom;
|
||||
|
||||
late int validTo;
|
||||
|
||||
late int? imageWidth;
|
||||
|
||||
late int? imageHeight;
|
||||
|
||||
late String? imageModified;
|
||||
|
||||
late bool? commentsAllowed;
|
||||
|
||||
late bool read = false;
|
||||
|
||||
late String? url;
|
||||
|
||||
late String? pdfName;
|
||||
|
||||
late bool voted;
|
||||
|
||||
late int numberOfVotes;
|
||||
|
||||
late List<ShortPollQuestion> questions;
|
||||
|
||||
ShortPoll({
|
||||
required this.id,
|
||||
required this.type,
|
||||
required this.text,
|
||||
required this.title,
|
||||
required this.validFrom,
|
||||
required this.validTo,
|
||||
this.imageWidth,
|
||||
this.imageHeight,
|
||||
this.imageModified,
|
||||
this.commentsAllowed,
|
||||
required this.read,
|
||||
this.url,
|
||||
this.pdfName,
|
||||
required this.voted,
|
||||
required this.numberOfVotes,
|
||||
required this.questions,
|
||||
});
|
||||
|
||||
/*factory ShortPoll.fromJson(Map<String, dynamic> json) {
|
||||
List<ShortPollQuestion> questions = [];
|
||||
|
||||
if (json["answers"] != null) {
|
||||
questions = List<ShortPollQuestion>.from(
|
||||
json["answers"].map((x) => ShortPollQuestion.fromJson(x)));
|
||||
}
|
||||
|
||||
return ShortPoll(
|
||||
id: json["id"],
|
||||
type: json["type"],
|
||||
text: json["text"],
|
||||
title: json["title"],
|
||||
validFrom: json["validFrom"],
|
||||
validTo: json["validTo"],
|
||||
imageWidth: json["imageWidth"],
|
||||
imageHeight: json["imageHeight"],
|
||||
imageModified: json["imageModified"],
|
||||
commentsAllowed: json["commentsAllowed"],
|
||||
read: json["read"],
|
||||
url: json["url"],
|
||||
pdfName: json["pdfName"],
|
||||
voted: json["voted"],
|
||||
numberOfVotes: json["numberOfVotes"],
|
||||
questions: questions,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"type": type,
|
||||
"text": text,
|
||||
"title": title,
|
||||
"validFrom": validFrom,
|
||||
"validTo": validTo,
|
||||
"imageWidth": imageWidth,
|
||||
"imageHeight": imageHeight,
|
||||
"imageModified": imageModified,
|
||||
"commentsAllowed": commentsAllowed,
|
||||
"read": read,
|
||||
"url": url,
|
||||
"pdfName": pdfName,
|
||||
"voted": voted,
|
||||
"numberOfVotes": numberOfVotes,
|
||||
};*/
|
||||
}
|
||||
Reference in new issue
Block a user