Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
course_model.dart
Go to the documentation of this file.
1import '../../domain/entities/course_entity.dart';
2
3class CourseModel extends CourseEntity {
4 const CourseModel({
5 super.id,
6 super.title,
7 super.description,
8 super.imageUrl,
9 super.pdfPath,
10 super.qcmPath,
11 super.durationMinutes,
12 super.progress,
13 super.iconColor,
14 super.createdAt,
15 });
16
17 factory CourseModel.fromJson(Map<String, dynamic> json) {
18 return CourseModel(
19 id: json['id'],
20 title: json['title'],
21 description: json['description'],
22 imageUrl: json['imageUrl'],
23 pdfPath: json['pdfPath'],
24 qcmPath: json['qcmPath'],
25 durationMinutes: json['durationMinutes'],
26 progress: 0.0, // Default to 0.0 as progress comes from SharedPreferences
27 iconColor: json['iconColor'],
28 createdAt:
29 json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
30 );
31 }
32
33 Map<String, dynamic> toJson() {
34 return {
35 'id': id,
36 'title': title,
37 'description': description,
38 'imageUrl': imageUrl,
39 'pdfPath': pdfPath,
40 'qcmPath': qcmPath,
41 'durationMinutes': durationMinutes,
42 'progress': progress,
43 'iconColor': iconColor,
44 'createdAt': createdAt?.toIso8601String(),
45 };
46 }
47}
Map< String, dynamic > toJson()
const CourseModel({ super.id, super.title, super.description, super.imageUrl, super.pdfPath, super.qcmPath, super.durationMinutes, super.progress, super.iconColor, super.createdAt, })
final String pdfPath
final String title
final double progress