Discussion.fromJson constructor
Implementation
factory Discussion.fromJson(Map<String, dynamic> json) {
final rootKey = json.keys.first;
final rootValue = json[rootKey] as Map<String, dynamic>;
json.remove(rootKey);
return Discussion(
Post.fromJson(rootValue),
comments: json.map(
(k, dynamic v) => MapEntry(k, Post.fromJson(v as Map<String, dynamic>)),
),
);
}