Arguments.fromJson constructor
Creates Arguments instance from JSON configuration.
Deserializes JSON configuration data to create an Xcrun Arguments instance. Validates required fields and provides proper error handling for missing or invalid configuration.
Parameters:
json- JSON configuration mapvariables- System variables for interpolation
Returns configured Arguments instance from JSON data.
Throws Exception if required field is missing:
- "file-path" is required
Example JSON:
{
"file-path": "/path/to/MyApp.ipa",
"api-key": "ABC123DEF4",
"api-issuer": "12345678-1234-1234-1234-123456789012",
"bundle-id": "com.example.myapp",
"validate-app": true
}
Implementation
factory Arguments.fromJson(
Map<String, dynamic> json, {
required Variables variables,
}) {
if (json['file-path'] == null) throw Exception("file-path is required");
return Arguments(
variables,
filePath: json['file-path'] as String,
username: json['username'] as String?,
password: json['password'] as String?,
apiKey: json['api-key'] as String?,
apiIssuer: json['api-issuer'] as String?,
appleId: json['apple-id'] as String?,
bundleVersion: json['bundle-version'] as String?,
bundleShortVersionString: json['bundle-short-version-string'] as String?,
ascPublicId: json['asc-public-id'] as String?,
type: json['type'] as String?,
validateApp: json['validate-app'] as bool? ?? false,
uploadPackage: json['upload-package'] as String?,
bundleId: json['bundle-id'] as String?,
productId: json['product-id'] as String?,
sku: json['sku'] as String?,
outputFormat: json['output-format'] as String?,
);
}