didvan-app/lib/models/mention/mention.dart

34 lines
780 B
Dart

import 'package:didvan/models/comment/user.dart';
class MentionData {
int id;
String text;
String createdAt;
List<String> mentions;
final UserOverview user;
MentionData({
required this.id,
required this.text,
required this.createdAt,
required this.mentions,
required this.user,
});
factory MentionData.fromJson(Map<String, dynamic> json) => MentionData(
id: json['id'],
text: json['text'],
createdAt: json['createdAt'],
mentions: List<String>.from(json['mentions']),
user: UserOverview.fromJson(json['user']),
);
Map<String, dynamic> toJson() => {
'id': id,
'text': text,
'createdAt': createdAt,
'mentions': mentions,
'user': user.toJson(),
};
}