md-app/lib/models/conferences_model.dart

70 lines
1.6 KiB
Dart

// Models of Conferences for MarkDown Text
import 'dart:ffi';
class ConferencesModel {
final int id;
final String title;
final DateTime date;
int activity;
int duration;
String place;
String city;
String state;
String country;
// List<String> type;
String thumb;
// List<String> translations;
ConferencesModel({
required this.id,
required this.title,
required this.date,
this.activity = 0,
this.duration = 0,
this.place = '',
this.city = '',
this.state = '',
this.country = '',
// this.type = const [],
this.thumb = '',
// this.translations = const [],
});
Map<String, dynamic> toJson() {
return {
'id': id,
'title': title,
'date': 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),
activity: json['activity'] ?? 0,
duration: json['duration'] ?? 0,
place: json['place'] ?? '',
city: json['city'] ?? '',
state: json['state'] ?? '',
country: json['country'] ?? '',
// type: List<String>.from(json['type'] ?? []),
thumb: json['thumb'] ?? '',
// translations: List<String>.from(json['translations'] ?? []),
);
}
}