toJson method
The JSON a device reads.
legacyAliases also writes libUrl/patchUrl, for as long as builds
from before the unified manifest are still installed. Drop it once they
are gone — the aliases are unsigned duplicates, and an old build reading
one is trusting an unsigned field.
Implementation
Map<String, Object?> toJson({bool legacyAliases = false}) =>
<String, Object?>{
'appId': appId,
'platform': platform.wire,
'releaseId': releaseId,
'engineVersion': engineVersion,
'versionCode': versionCode,
'versionName': versionName,
'patchNumber': patchNumber,
'artifactUrl': artifactUrl,
'sha256': artifactSha256,
'sizeBytes': artifactSizeBytes,
'rolloutPercent': rolloutPercent,
'notes': notes,
if (revoked) 'revoked': true,
if (revokedReason != null) 'revokedReason': revokedReason,
'signature': signature,
'keyId': keyId,
'sigVersion': sigVersion,
if (delta != null) 'delta': delta!.toJson(),
if (signatureV2 != null) 'signatureV2': signatureV2,
if (legacyAliases) ...<String, Object?>{
if (platform == PatchPlatform.android) 'libUrl': artifactUrl,
if (platform == PatchPlatform.ios) 'patchUrl': artifactUrl,
},
};