Skip to content
pubscout

gcloud

0.9.0, released a year ago by labs.dart.dev

High-level Dart API for Google Cloud Storage, Pub/Sub, and Datastore.

Quiet but busy
$ flutter pub add gcloud
Source repository

What it does

Provides an idiomatic Dart interface to interact with Google Cloud Platform services such as Cloud Datastore, Cloud Storage, and Cloud Pub/Sub. It simplifies tasks like managing NoSQL entities, uploading and reading files in buckets, and handling asynchronous messaging.

AI-written summary of version 0.9.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a Dart server-side or command-line application that communicates with Google Cloud Platform.
  • You need to interact with Google Cloud Storage, Cloud Datastore, or Cloud Pub/Sub using Dart.

Skip it when

  • You are writing client-side code running in the browser or in a Flutter application.
  • You need a production-ready package without the risk of experimental API changes.

Strengths

  • Provides high-level idiomatic bindings for major GCP services in Dart.
  • Integrates with the `appengine` package and service scopes for server applications.

Weaknesses

  • Currently marked as experimental with a high expected rate of breaking changes.
  • Not supported on the web or in Flutter applications.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
5

Requires service account credentials from a Google Cloud Project and appropriate environment variables or configuration files.

var jsonCredentials = new File('my-project.json').readAsStringSync();
var credentials = new auth.ServiceAccountCredentials.fromJson(jsonCredentials);
var scopes = []
    ..addAll(datastore.Datastore.Scopes)
    ..addAll(Storage.SCOPES)
    ..addAll(PubSub.SCOPES);
var client = await auth.clientViaServiceAccount(credentials, scopes);
var storage = new Storage(client, 'my-project');
var bucket = await storage.createBucket('my-bucket');

Alternatives

Packages that do the same job and could replace gcloud.

Works with

Packages commonly used together with gcloud: ones it builds on, ones built on it, and its own family.