import 'dart:convert'; import 'dart:typed_data'; import 'package:json_annotation/json_annotation.dart'; part 'patched_application.g.dart'; @JsonSerializable() class PatchedApplication { String name; final String packageName; String version; final String apkFilePath; @JsonKey( fromJson: decodeBase64, toJson: encodeBase64, ) Uint8List icon; DateTime patchDate; final bool isRooted; final bool isFromStorage; bool hasUpdates; List appliedPatches; List changelog; PatchedApplication({ required this.name, required this.packageName, required this.version, required this.apkFilePath, required this.icon, required this.patchDate, this.isRooted = false, this.isFromStorage = false, this.hasUpdates = false, this.appliedPatches = const [], this.changelog = const [], }); factory PatchedApplication.fromJson(Map json) => _$PatchedApplicationFromJson(json); Map toJson() => _$PatchedApplicationToJson(this); static Uint8List decodeBase64(String icon) => base64.decode(icon); static String encodeBase64(Uint8List bytes) => base64.encode(bytes); }