-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinfo_model.dart
More file actions
77 lines (75 loc) · 2 KB
/
info_model.dart
File metadata and controls
77 lines (75 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class InfoModel {
String? version;
late int nbElements;
late int nbCategories;
late int nbVirtual;
late int nbPhysical;
late int nbImageCategory;
late int nbTags;
late int nbImageTag;
late int nbUsers;
late int nbGroups;
late int nbComments;
String? firstDate;
late int cacheSize;
InfoModel({
this.version,
this.nbElements = 0,
this.nbCategories = 0,
this.nbVirtual = 0,
this.nbPhysical = 0,
this.nbImageCategory = 0,
this.nbTags = 0,
this.nbImageTag = 0,
this.nbUsers = 0,
this.nbGroups = 0,
this.nbComments = 0,
this.firstDate,
this.cacheSize = 0,
});
InfoModel.fromJson(Map<String, dynamic> json) {
for (Map<String, dynamic> info in json['infos']) {
switch (info['name']) {
case 'version':
version = info['value'];
break;
case 'nb_elements':
nbElements = int.tryParse(info['value']) ?? 0;
break;
case 'nb_categories':
nbCategories = int.tryParse(info['value']) ?? 0;
break;
case 'nb_virtual':
nbVirtual = int.tryParse(info['value']) ?? 0;
break;
case 'nb_physical':
nbPhysical = int.tryParse(info['value']) ?? 0;
break;
case 'nb_image_category':
nbImageCategory = int.tryParse(info['value']) ?? 0;
break;
case 'nb_tags':
nbTags = int.tryParse(info['value']) ?? 0;
break;
case 'nb_image_tag':
nbImageTag = int.tryParse(info['value']) ?? 0;
break;
case 'nb_users':
nbUsers = int.tryParse(info['value']) ?? 0;
break;
case 'nb_groups':
nbGroups = int.tryParse(info['value']) ?? 0;
break;
case 'nb_comments':
nbComments = int.tryParse(info['value']) ?? 0;
break;
case 'first_date':
firstDate = info['value'];
break;
case 'cache_size':
cacheSize = info['value'] ?? 0;
break;
}
}
}
}