podcast overview
This commit is contained in:
parent
7f0d0689f8
commit
3a0622939e
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:didvan/models/category.dart';
|
||||
import 'package:html/parser.dart';
|
||||
|
||||
class OverviewData {
|
||||
final int id;
|
||||
|
|
@ -33,28 +34,33 @@ class OverviewData {
|
|||
this.categories,
|
||||
});
|
||||
|
||||
factory OverviewData.fromJson(Map<String, dynamic> json) => OverviewData(
|
||||
id: json['id'],
|
||||
title: json['title'],
|
||||
image: json['image'],
|
||||
description: json['description'],
|
||||
timeToRead: json['timeToRead'],
|
||||
reference: json['reference'],
|
||||
forManagers: json['forManagers'] ?? false,
|
||||
comments: json['comments'] ?? 0,
|
||||
createdAt: json['createdAt'],
|
||||
duration: json['duration'],
|
||||
type: json['type'] ?? '',
|
||||
marked: json['marked'] ?? true,
|
||||
media: json['media'],
|
||||
categories: json['categories'] != null
|
||||
? List<CategoryData>.from(
|
||||
json['categories'].map(
|
||||
(e) => CategoryData.fromJson(e),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
factory OverviewData.fromJson(Map<String, dynamic> json) {
|
||||
final document = parse(json['description']);
|
||||
final String parsedString =
|
||||
parse(document.body!.text).documentElement!.text;
|
||||
return OverviewData(
|
||||
id: json['id'],
|
||||
title: json['title'],
|
||||
image: json['image'],
|
||||
description: parsedString,
|
||||
timeToRead: json['timeToRead'],
|
||||
reference: json['reference'],
|
||||
forManagers: json['forManagers'] ?? false,
|
||||
comments: json['comments'] ?? 0,
|
||||
createdAt: json['createdAt'],
|
||||
duration: json['duration'],
|
||||
type: json['type'] ?? '',
|
||||
marked: json['marked'] ?? true,
|
||||
media: json['media'],
|
||||
categories: json['categories'] != null
|
||||
? List<CategoryData>.from(
|
||||
json['categories'].map(
|
||||
(e) => CategoryData.fromJson(e),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue