fix types

This commit is contained in:
shenlong-tanwen
2025-09-04 01:58:02 +05:30
parent 82c93cf325
commit 254ca4a13d
6 changed files with 161 additions and 189 deletions
@@ -6,33 +6,33 @@ enum RemoteAssetMetadataKey {
final String key;
const RemoteAssetMetadataKey(this.key);
factory RemoteAssetMetadataKey.fromKey(String key) {
switch (key) {
case "mobile-app":
return RemoteAssetMetadataKey.mobileApp;
default:
throw ArgumentError("Unknown AssetMetadataKey key: $key");
}
}
}
class RemoteAssetMetadata {
final String? cloudId;
class RemoteAssetMetadataItem {
final RemoteAssetMetadataKey key;
final Object value;
const RemoteAssetMetadata({this.cloudId});
const RemoteAssetMetadataItem({required this.key, required this.value});
Map<String, dynamic> toMap() {
final mobileAppValue = {};
if (cloudId != null) {
mobileAppValue["iCloudId"] = cloudId;
}
return {
"metadata": [
{"key": RemoteAssetMetadataKey.mobileApp.key, "value": mobileAppValue},
],
};
Map<String, Object?> toMap() {
return {'key': key.key, 'value': value};
}
String toJson() => json.encode(toMap());
}
class RemoteAssetMobileAppMetadata {
final String? cloudId;
const RemoteAssetMobileAppMetadata({this.cloudId});
Map<String, Object?> toMap() {
final map = <String, Object?>{};
if (cloudId != null) {
map["iCloudId"] = cloudId;
}
return map;
}
String toJson() => json.encode(toMap());