patched_application.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'dart:convert';
  2. import 'dart:typed_data';
  3. import 'package:json_annotation/json_annotation.dart';
  4. part 'patched_application.g.dart';
  5. @JsonSerializable()
  6. class PatchedApplication {
  7. PatchedApplication({
  8. required this.name,
  9. required this.packageName,
  10. required this.version,
  11. required this.apkFilePath,
  12. required this.icon,
  13. required this.patchDate,
  14. this.isRooted = false,
  15. this.isFromStorage = false,
  16. this.appliedPatches = const [],
  17. this.patchedFilePath = '',
  18. this.fileSize = 0,
  19. });
  20. factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
  21. _$PatchedApplicationFromJson(json);
  22. String name;
  23. String packageName;
  24. String version;
  25. final String apkFilePath;
  26. @JsonKey(
  27. fromJson: decodeBase64,
  28. toJson: encodeBase64,
  29. )
  30. Uint8List icon;
  31. DateTime patchDate;
  32. bool isRooted;
  33. bool isFromStorage;
  34. List<String> appliedPatches;
  35. String patchedFilePath;
  36. int fileSize;
  37. Map<String, dynamic> toJson() => _$PatchedApplicationToJson(this);
  38. static Uint8List decodeBase64(String icon) => base64.decode(icon);
  39. static String encodeBase64(Uint8List bytes) => base64.encode(bytes);
  40. }