Arguments.fromJson constructor
Creates Arguments instance from JSON configuration.
Deserializes JSON configuration data to create a Fastlane Arguments instance. Provides default values for optional parameters and validates required configuration.
Parameters:
json- JSON configuration mapvariables- System variables for interpolation
Returns configured Arguments instance from JSON data.
Throws Exception if required fields are missing:
- "file-path" is required
- "binary-type" is required
Example JSON:
{
"file-path": "/path/to/app.aab",
"binary-type": "aab",
"track": "production",
"metadata-path": "/path/to/metadata"
}
Implementation
factory Arguments.fromJson(
Map<String, dynamic> json, {
required Variables variables,
}) {
if (json['file-path'] == null) throw Exception("file-path is required");
if (json['binary-type'] == null) throw Exception("binary-type is required");
return Arguments(
variables,
filePath:
json['file-path'] ?? path.join(Files.androidOutputApks.path, "*.apk"),
binaryType: json['binary-type'],
versionName: json['version-name'],
versionCode: json['version-code'],
releaseStatus: json['release-status'],
jsonKeyData: json['json-key-data'],
apk: json['apk'],
aab: json['aab'],
track: json['track'] ?? "production",
rollout: double.tryParse(json['rollout'] ?? ''),
metadataPath:
json['metadata-path'] ?? Files.androidDistributionMetadataDir.path,
jsonKey: json['json-key'] ?? path.join("distribution", "google-key.json"),
apkPaths: (json['apk-paths'])?.toString().split(","),
aabPaths: (json['aab-paths'])?.toString().split(","),
skipUploadApk: json['skip-upload-apk'] ?? false,
skipUploadAab: json['skip-upload-aab'] ?? false,
skipUploadMetadata: json['skip-upload-metadata'] ?? false,
skipUploadChangelogs: json['skip-upload-changelogs'] ?? false,
skipUploadImages: json['skip-upload-images'] ?? false,
skipUploadScreenshots: json['skip-upload-screenshots'] ?? false,
syncImageUpload: json['sync-image-upload'] ?? false,
trackPromoteTo: json['track-promote-to'],
trackPromoteReleaseStatus: json['track-promote-release-status'],
validateOnly: json['validate-only'] ?? false,
mapping: json['mapping'],
mappingPaths: (json['mapping-paths'])?.toString().split(","),
rootUrl: json['root-url'],
timeout: int.tryParse(json['timeout'].toString()) ?? 300,
versionCodesToRetain: (json['version-codes-to-retain'])?.cast<int>(),
changesNotSentForReview:
(json['changes-not-sent-for-review'] as bool?) ?? false,
rescueChangesNotSentForReview:
(json['rescue-changes-not-sent-for-review'] as bool?) ?? true,
inAppUpdatePriority:
int.tryParse(json['in-app-update-priority'].toString()) ?? 0,
obbMainReferencesVersion: int.tryParse(
json['obb-main-references-version'].toString(),
),
obbMainFileSize: int.tryParse(json['obb-main-file-size'].toString()),
obbPatchReferencesVersion: int.tryParse(
json['obb-patch-references-version'].toString(),
),
obbPatchFileSize: int.tryParse(json['obb-patch-file-size'].toString()),
ackBundleInstallationWarning:
(json['ack-bundle-installation-warning'] as bool?) ?? false,
uploadDebugSymbols: json['upload-debug-symbols'] ?? true,
);
}