44 lines
994 B
Dart
44 lines
994 B
Dart
|
|
import 'dart:convert';
|
|
|
|
import 'product_image.dart';
|
|
|
|
class Comment {
|
|
int id;
|
|
String contact;
|
|
String content;
|
|
int rating;
|
|
List<ProductImage> images;
|
|
String createdAt;
|
|
int thumbUp;
|
|
int thumbDown;
|
|
String replyFromStore;
|
|
|
|
Comment.fromJson(Map<String, dynamic> json) :
|
|
id = json['id'],
|
|
contact = json['contact'],
|
|
content = json['content'],
|
|
rating = json['rating'],
|
|
images = (json['images'] as List).map((e) => ProductImage.fromJson(e)).toList(),
|
|
createdAt = json['created_at'],
|
|
thumbUp = json['thumb_up'],
|
|
thumbDown = json['thumb_down'],
|
|
replyFromStore = json['reply_from_store'];
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'contact': contact,
|
|
'content': content,
|
|
'rating': rating,
|
|
'images': images,
|
|
'created_at': createdAt,
|
|
'thumb_up': thumbUp,
|
|
'thumb_down': thumbDown,
|
|
'reply_from_store': replyFromStore,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
} |