createBuilds static method
Future<AppBuildsUpload>
createBuilds(
- Client cloudApiClient, {
- required String projectId,
- required List<
FlutterPlatform> platforms, - required String flutterAppDir,
- required int archiveSize,
- String? versionName,
- GitMetadata? gitMetadata,
Requests a build of the Flutter app in flutterAppDir of the archive
for each of platforms in project projectId, and returns the build
ids with the upload description for an archive of archiveSize bytes.
versionName is the app version the builds are made with.
Throws FailureException if the request fails.
Implementation
static Future<AppBuildsUpload> createBuilds(
Client cloudApiClient, {
required String projectId,
required List<FlutterPlatform> platforms,
required String flutterAppDir,
required int archiveSize,
String? versionName,
GitMetadata? gitMetadata,
}) async {
final appPlatforms = platforms.map(_appPlatform).toList();
try {
return await cloudApiClient.appBuilds.createBuilds(
cloudCapsuleId: projectId,
platforms: appPlatforms,
flutterAppDir: flutterAppDir,
archiveSize: archiveSize,
versionName: versionName,
commitHash: gitMetadata?.commitHash,
commitMessage: gitMetadata?.commitMessage,
branch: gitMetadata?.branch,
);
} on UploadTooLargeException catch (e) {
throw FailureException(
error: e.message,
hint: 'Exclude files from the app with a .scloudignore file.',
);
} on AppPublishingDisabledException catch (e) {
throw FailureException(error: e.message);
} on InvalidValueException catch (e) {
throw FailureException(error: e.message);
} on NotFoundException catch (e) {
throw FailureException(error: e.message);
} on Exception catch (e, stackTrace) {
throw FailureException.nested(
e,
stackTrace,
'Failed to request the app builds.',
);
}
}