validate method
void
validate()
Validates required schema, identity, artifact, and install fields.
Implementation
void validate() {
if (schemaVersion != 3) {
throw FormatException(
"Unsupported release descriptor schema version: $schemaVersion",
);
}
if (packageId.trim().isEmpty) {
throw const FormatException("release.json packageId is required.");
}
if (appName.trim().isEmpty) {
throw const FormatException("release.json appName is required.");
}
if (version.trim().isEmpty) {
throw const FormatException("release.json version is required.");
}
if (platform.trim().isEmpty) {
throw const FormatException("release.json platform is required.");
}
if (channel.trim().isEmpty) {
throw const FormatException("release.json channel is required.");
}
if (buildNumber != null && buildNumber! < 0) {
throw const FormatException(
"release.json buildNumber must be zero or greater when provided.",
);
}
if (artifact.kind == "pkgInstaller" && buildNumber == null) {
throw const FormatException(
"release.json buildNumber is required for pkgInstaller artifacts.",
);
}
artifact.validate();
for (final deltaArtifact in deltaArtifacts) {
deltaArtifact.validate();
}
install.validate(platform: platform, artifactKind: artifact.kind);
}