26 lines
702 B
Dart
26 lines
702 B
Dart
/// Question pushed from the API over the SignalR questions hub.
|
|
class IncomingQuestion {
|
|
const IncomingQuestion({
|
|
required this.id,
|
|
required this.text,
|
|
required this.sentAt,
|
|
this.unansweredCount = 1,
|
|
});
|
|
|
|
final String id;
|
|
final String text;
|
|
final DateTime sentAt;
|
|
|
|
/// Unanswered questions in the database for this user (from API).
|
|
final int unansweredCount;
|
|
|
|
factory IncomingQuestion.fromJson(Map<String, dynamic> json) {
|
|
return IncomingQuestion(
|
|
id: json['id'] as String,
|
|
text: json['text'] as String,
|
|
sentAt: DateTime.parse(json['sentAt'] as String).toUtc(),
|
|
unansweredCount: (json['unansweredCount'] as num?)?.toInt() ?? 1,
|
|
);
|
|
}
|
|
}
|