D1APP-48 radar overview model
This commit is contained in:
parent
6e13f37ede
commit
fdff9669a6
|
|
@ -0,0 +1,16 @@
|
|||
class Category {
|
||||
final int id;
|
||||
final String label;
|
||||
|
||||
const Category({required this.id, required this.label});
|
||||
|
||||
factory Category.fromJson(Map<String, dynamic> json) => Category(
|
||||
id: json['id'],
|
||||
label: json['label'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'label': label,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import 'category.dart';
|
||||
|
||||
class RadarOverview {
|
||||
final int id;
|
||||
final String image;
|
||||
final String title;
|
||||
final String description;
|
||||
final int timeToRead;
|
||||
final String createdAt;
|
||||
final bool forManagers;
|
||||
final bool marked;
|
||||
final List<Category> categories;
|
||||
|
||||
const RadarOverview({
|
||||
required this.id,
|
||||
required this.image,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.timeToRead,
|
||||
required this.createdAt,
|
||||
required this.forManagers,
|
||||
required this.marked,
|
||||
required this.categories,
|
||||
});
|
||||
|
||||
factory RadarOverview.fromJson(Map<String, dynamic> json) => RadarOverview(
|
||||
id: json['id'],
|
||||
image: json['image'],
|
||||
title: json['title'],
|
||||
description: json['description'],
|
||||
timeToRead: json['timeToRead'],
|
||||
createdAt: json['createdAt'],
|
||||
forManagers: json['forManagers'],
|
||||
marked: json['marked'],
|
||||
categories: List<Category>.from(
|
||||
json['categories'].map(
|
||||
(category) => Category.fromJson(category),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'image': image,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'timeToRead': timeToRead,
|
||||
'createdAt': createdAt,
|
||||
'forManagers': forManagers,
|
||||
'marked': marked,
|
||||
'categories': categories.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue