Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:convert';
- CategoryItemModel categoryItemModelFromJson(String str) => CategoryItemModel.fromJson(json.decode(str));
- String categoryItemModelToJson(CategoryItemModel data) => json.encode(data.toJson());
- class CategoryItemModel {
- CategoryItemModel({
- this.success,
- this.message,
- this.data,
- });
- bool success;
- String message;
- Data data;
- factory CategoryItemModel.fromJson(Map<String, dynamic> json) => CategoryItemModel(
- success: json["success"],
- message: json["message"],
- data: Data.fromJson(json["data"]),
- );
- Map<String, dynamic> toJson() => {
- "success": success,
- "message": message,
- "data": data.toJson(),
- };
- }
- class Data {
- Data({
- this.customTags,
- this.userTags,
- });
- List<CustomTag> customTags;
- List<Tag> userTags;
- factory Data.fromJson(Map<String, dynamic> json) => Data(
- customTags: List<CustomTag>.from(json["custom_tags"].map((x) => CustomTag.fromJson(x))),
- userTags: List<Tag>.from(json["user_tags"].map((x) => Tag.fromJson(x))),
- );
- Map<String, dynamic> toJson() => {
- "custom_tags": List<dynamic>.from(customTags.map((x) => x.toJson())),
- "user_tags": List<dynamic>.from(userTags.map((x) => x.toJson())),
- };
- }
- class CustomTag {
- CustomTag({
- this.id,
- this.userId,
- this.name,
- this.deletedAt,
- this.createdAt,
- this.updatedAt,
- });
- int id;
- int userId;
- String name;
- dynamic deletedAt;
- DateTime createdAt;
- DateTime updatedAt;
- factory CustomTag.fromJson(Map<String, dynamic> json) => CustomTag(
- id: json["id"],
- userId: json["user_id"],
- name: json["name"],
- deletedAt: json["deleted_at"],
- createdAt: DateTime.parse(json["created_at"]),
- updatedAt: DateTime.parse(json["updated_at"]),
- );
- Map<String, dynamic> toJson() => {
- "id": id,
- "user_id": userId,
- "name": name,
- "deleted_at": deletedAt,
- "created_at": createdAt.toIso8601String(),
- "updated_at": updatedAt.toIso8601String(),
- };
- }
- class Tag {
- Tag({
- this.id,
- this.name,
- this.slug,
- this.icon,
- this.thumbs,
- this.createdAt,
- this.updatedAt,
- this.tags,
- this.translated,
- this.tagCategoryId,
- this.flyerItemsCount,
- });
- int id;
- String name;
- String slug;
- String icon;
- Thumbs thumbs;
- DateTime createdAt;
- DateTime updatedAt;
- List<Tag> tags;
- dynamic translated;
- int tagCategoryId;
- int flyerItemsCount;
- factory Tag.fromJson(Map<String, dynamic> json) => Tag(
- id: json["id"],
- name: json["name"],
- slug: json["slug"],
- icon: json["icon"],
- thumbs: Thumbs.fromJson(json["thumbs"]),
- createdAt: DateTime.parse(json["created_at"]),
- updatedAt: DateTime.parse(json["updated_at"]),
- tags: json["tags"] == null ? null : List<Tag>.from(json["tags"].map((x) => Tag.fromJson(x))),
- translated: json["translated"],
- tagCategoryId: json["tag_category_id"] == null ? null : json["tag_category_id"],
- flyerItemsCount: json["flyer_items_count"] == null ? null : json["flyer_items_count"],
- );
- Map<String, dynamic> toJson() => {
- "id": id,
- "name": name,
- "slug": slug,
- "icon": icon,
- "thumbs": thumbs.toJson(),
- "created_at": createdAt.toIso8601String(),
- "updated_at": updatedAt.toIso8601String(),
- "tags": tags == null ? null : List<dynamic>.from(tags.map((x) => x.toJson())),
- "translated": translated,
- "tag_category_id": tagCategoryId == null ? null : tagCategoryId,
- "flyer_items_count": flyerItemsCount == null ? null : flyerItemsCount,
- };
- }
- class Thumbs {
- Thumbs({
- this.lg,
- this.md,
- this.sm,
- this.xs,
- });
- String lg;
- String md;
- String sm;
- String xs;
- factory Thumbs.fromJson(Map<String, dynamic> json) => Thumbs(
- lg: json["lg"],
- md: json["md"],
- sm: json["sm"],
- xs: json["xs"],
- );
- Map<String, dynamic> toJson() => {
- "lg": lg,
- "md": md,
- "sm": sm,
- "xs": xs,
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment