AppUsageData.fromJson constructor
Constructor to initialize the object from a JSON map.
Implementation
AppUsageData.fromJson(Map<String, dynamic> json) {
packageName = json['packageName'];
appLabel = json['appLabel'];
icon = json['icon']; // Base64 string from JSON
if (icon != null) {
memoryIcon = base64Decode(icon!); // Decode Base64 to Uint8List
}
installTime = DateTime.fromMillisecondsSinceEpoch(json['installTime']);
if (json['usages'] != null) {
usages = <Usages>[];
json['usages'].forEach((v) {
usages!.add(Usages.fromJson(v.cast<String, dynamic>()));
});
}
}