initClient method

Future<GoogleApisClientApiKey> initClient({
  1. required GoogleApisClientApiKey googleApisClientApiKey,
})

Implementation

Future<GoogleApisClientApiKey> initClient({
  required GoogleApisClientApiKey googleApisClientApiKey,
}) async {
  if (googleApisClientApiKey.is_init) {
    return googleApisClientApiKey;
  }
  if (googleApisClientApiKey["@type"] == "serviceAccount" ||
      googleApisClientApiKey["type"] == "service_account") {
    googleApisClientApiKey.google_auth_client = await clientViaServiceAccount(
      ServiceAccountCredentials.fromJson(
        googleApisClientApiKey.rawData,
      ),
      scopes,
    );
    googleApisClientApiKey.is_init = false;
    return googleApisClientApiKey;
  }
  return googleApisClientApiKey;
}