class AppUpdateAsset { final String name; final String downloadUrl; final int size; final String? sha256; final String? version; const AppUpdateAsset({ required this.name, required this.downloadUrl, required this.size, this.sha256, this.version, }); factory AppUpdateAsset.fromJson(Map json) { return AppUpdateAsset( name: json['name']?.toString() ?? '', downloadUrl: json['browser_download_url']?.toString() ?? json['browserDownloadUrl']?.toString() ?? json['url']?.toString() ?? '', size: json['size'] is int ? json['size'] as int : 0, sha256: (json['sha256']?.toString().trim().isEmpty ?? true) ? null : json['sha256'].toString().trim().toLowerCase(), version: (json['version']?.toString().trim().isEmpty ?? true) ? null : json['version'].toString().trim(), ); } } class AppUpdateInfo { final String version; final String releaseNotes; final Uri htmlUrl; final List assets; final Map platformAssets; final AppUpdateAsset? selectedAsset; final bool noAssetForPlatform; const AppUpdateInfo({ required this.version, required this.releaseNotes, required this.htmlUrl, required this.assets, this.platformAssets = const {}, this.selectedAsset, this.noAssetForPlatform = false, }); AppUpdateInfo copyWith({ String? version, String? releaseNotes, Uri? htmlUrl, List? assets, Map? platformAssets, AppUpdateAsset? selectedAsset, bool? noAssetForPlatform, }) { return AppUpdateInfo( version: version ?? this.version, releaseNotes: releaseNotes ?? this.releaseNotes, htmlUrl: htmlUrl ?? this.htmlUrl, assets: assets ?? this.assets, platformAssets: platformAssets ?? this.platformAssets, selectedAsset: selectedAsset ?? this.selectedAsset, noAssetForPlatform: noAssetForPlatform ?? this.noAssetForPlatform, ); } } class UpdateCheckResult { final bool hasUpdate; final AppUpdateInfo? info; const UpdateCheckResult({required this.hasUpdate, this.info}); }