FeedbackEntry.fromJson constructor
Deserialises from a JSON map previously produced by toJson.
Implementation
factory FeedbackEntry.fromJson(Map<String, dynamic> json) {
return FeedbackEntry(
category: (json['category'] as String?) ?? 'other',
message: (json['message'] as String?) ?? '',
platform: (json['platform'] as String?) ?? '',
appVersion: (json['appVersion'] as String?) ?? '',
createdAt:
DateTime.tryParse((json['createdAt'] as String?) ?? '') ??
DateTime.now(),
screenshots:
(json['screenshots'] as List<dynamic>?)?.cast<String>() ?? const [],
metadata: json['metadata'] != null
? FeedbackMetadata.fromJson(
json['metadata'] as Map<String, dynamic>)
: null,
sessionContext: json['sessionContext'] != null
? FeedbackSessionContext.fromJson(
json['sessionContext'] as Map<String, dynamic>)
: null,
rating: json['rating'] as int?,
npsScore: json['npsScore'] as int?,
);
}