make static method

Future<SkiaPerfDestination> make(
  1. AuthClient client,
  2. String projectId, {
  3. bool isTesting = false,
})

Create from an AuthClient and a GCP project id.

AuthClient can be obtained from functions like clientViaUserConsent.

Implementation

static Future<SkiaPerfDestination> make(AuthClient client, String projectId,
    {bool isTesting = false}) async {
  final Storage storage = Storage(client, projectId);
  final String bucketName = isTesting ? kTestBucketName : kBucketName;
  if (!await storage.bucketExists(bucketName)) {
    throw StateError('Bucket $bucketName does not exist.');
  }
  final SkiaPerfGcsAdaptor adaptor =
      SkiaPerfGcsAdaptor(storage.bucket(bucketName));
  final GcsLock lock = GcsLock(StorageApi(client), bucketName);
  return SkiaPerfDestination(adaptor, lock);
}