Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

pub package package publisher

NOTE: This is a community-supported project, meaning there is no official level of support. The code is not covered by any SLA or deprecation policy.

Feel free to open issues for bugs and feature requests.

Utilities for running Dart code correctly on the Google Cloud Platform.

Features

  • Project Discovery: Automatically discover the Google Cloud Project ID using multiple strategies:
    • Environment variables (e.g., GOOGLE_CLOUD_PROJECT).
    • Service account credentials file (GOOGLE_APPLICATION_CREDENTIALS).
    • gcloud CLI configuration.
    • Google Cloud Metadata Server.
  • Metadata API: Flexible access to the Metadata Server with built-in caching (getMetadataValue) or direct fetching (fetchMetadataValue).
  • Identity Discovery: Retrieve the default service account email.
  • Core: Low-level utilities for Google Cloud libraries.

Usage

Project Discovery

import 'package:google_cloud/google_cloud.dart';

void main() async {
  // Discovers the project ID using all available strategies.
  // Discovery via the Metadata Server is cached for the lifetime of the
  // process.
  final projectId = await computeProjectId();
  print('Running in project: $projectId');
}