backup. before shop update
This commit is contained in:
58
lib/models/blog.dart
Normal file
58
lib/models/blog.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
class Section {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
Section.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
name = json['name'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class Blog {
|
||||
int id;
|
||||
String title;
|
||||
String body;
|
||||
String createdAt;
|
||||
String thumbUrl;
|
||||
String imageUrl;
|
||||
String videoUrl;
|
||||
Section section;
|
||||
|
||||
Blog.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
title = json['title'],
|
||||
body = json['body'],
|
||||
createdAt = json['created_at'],
|
||||
thumbUrl = json['thumb_url'],
|
||||
imageUrl = json['image_url'],
|
||||
videoUrl = json['video_url'],
|
||||
section = Section.fromJson(json['section']);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'title': title,
|
||||
'body': body,
|
||||
'created_at': createdAt,
|
||||
'thumb_url': thumbUrl,
|
||||
'image_url': imageUrl,
|
||||
'video_url': videoUrl,
|
||||
'section': section,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user