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). gcloudCLI configuration.- Google Cloud Metadata Server.
- Environment variables (e.g.,
- 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');
}
Libraries
- constants
- Constants for Google Cloud Platform integration.
- general
- google_cloud
- General Google Cloud Platform integration features.