Arguments constructor

Arguments(
  1. Variables variables, {
  2. required String filePath,
  3. required String binaryType,
  4. String? credentialFile,
  5. String? clientId,
  6. String? clientSecret,
  7. String? appId,
  8. String? releaseNotes,
  9. String language = 'en-US',
  10. bool submit = true,
  11. int releaseType = 1,
  12. Duration pollInterval = const Duration(seconds: 15),
  13. Duration pollTimeout = const Duration(minutes: 10),
  14. String baseUrl = defaultBaseUrl,
  15. Dio? dio,
})

Implementation

Arguments(
  Variables variables, {
  required super.filePath,
  required super.binaryType,
  this.credentialFile,
  this.clientId,
  this.clientSecret,
  this.appId,
  this.releaseNotes,
  this.language = 'en-US',
  this.submit = true,
  this.releaseType = 1,
  this.pollInterval = const Duration(seconds: 15),
  this.pollTimeout = const Duration(minutes: 10),
  this.baseUrl = defaultBaseUrl,
  Dio? dio,
})  : _dio = dio ?? Dio(BaseOptions(baseUrl: baseUrl)),
      super('huawei', variables) {
  final serviceAccount = credentialFile?.trim().isNotEmpty == true;
  final apiClient = clientId?.trim().isNotEmpty == true &&
      clientSecret?.trim().isNotEmpty == true;
  if (serviceAccount == apiClient) {
    throw ArgumentError(
      'Huawei requires either credential-file (recommended Service Account) '
      'or both client-id and client-secret, but not both modes.',
    );
  }
  if (!{'apk', 'aab'}.contains(binaryType.toLowerCase())) {
    throw ArgumentError("Huawei binary-type must be 'apk' or 'aab'.");
  }
  if (releaseType != 1) {
    throw ArgumentError(
      'Huawei currently supports release-type 1 only; phased release '
      'requires additional rollout settings.',
    );
  }
}