66 lines
1.5 KiB
Dart
66 lines
1.5 KiB
Dart
// Models of Conferences for MarkDown Text
|
|
|
|
class ConferencesModel {
|
|
final int id;
|
|
final String title;
|
|
final String date;
|
|
String activity;
|
|
String duration;
|
|
String place;
|
|
String city;
|
|
String state;
|
|
String country;
|
|
String type;
|
|
String thumb;
|
|
List<String> translations;
|
|
|
|
ConferencesModel({
|
|
required this.id,
|
|
required this.title,
|
|
required this.date,
|
|
this.activity = '',
|
|
this.duration = '',
|
|
this.place = '',
|
|
this.city = '',
|
|
this.state = '',
|
|
this.country = '',
|
|
this.type = '',
|
|
this.thumb = '',
|
|
this.translations = const [],
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'title': title,
|
|
'date': DateTime.parse(date).toIso8601String(),
|
|
'activity': activity,
|
|
'duration': duration,
|
|
'place': place,
|
|
'city': city,
|
|
'state': state,
|
|
'country': country,
|
|
'type': type,
|
|
'thumb': thumb.toString(),
|
|
'translations': translations,
|
|
};
|
|
}
|
|
|
|
factory ConferencesModel.fromJson(Map<String, dynamic> json) {
|
|
return ConferencesModel(
|
|
id: json['id'],
|
|
title: json['title'],
|
|
date: DateTime.parse(json['date'] as String).toIso8601String(),
|
|
activity: json['activity'] ?? '',
|
|
duration: json['duration'] ?? '',
|
|
place: json['place'] ?? '',
|
|
city: json['city'] ?? '',
|
|
state: json['state'] ?? '',
|
|
country: json['country'] ?? '',
|
|
type: json['type'] ?? '',
|
|
thumb: json['thumb'] ?? '',
|
|
translations: List<String>.from(json['translations'] ?? []),
|
|
);
|
|
}
|
|
}
|