New Google APIs Client Libraries for Dart

| by James Chesters Follow 2 Followers on Oct 01, 2014. Estimated reading time: 2 minutes |

Dart Engineer Søren Gjesse, has this week announced to the community new packages for accessing Google APIs.

Writing about the new packages on Dart News & Updates, Gjesse says the API generator has been built to create Dart client libraries enabling access to Google services, including YouTube, Analytics, Google+ and Drive from Dart.

The two new packages, googleapis and googleapis_beta, are based on previous work by GDEs Adam Singer and Gerwin Sturm.

Gjesse says: 

The googleapis package contains all the APIs that are available in a stable version. The googleapis_beta package contains the APIs that are currently in beta and only available through a Limited Preview program. We will be updating these packages on a monthly basis to ensure that they provide access to new services as they become available.

Along with the generated APIs, we have published a googleapis_auth package that handles all the different authorization models supported to access the APIs from different environments. Using googleapis_auth makes it easy to use the client libraries in a standalone application, on a Google Compute Engine instance, or in the browser.

The feedback to the official Dart News article was positive, with the community expressing thanks to the team -- although there was also some polite dissent elsewhere. 

Commenting on the announcement in the Dart Misc Google group, user Günter Zöchbauer said:

These packages are great!

Why there is no support for accessing the Datastore using Protobuf in addition to JSON? There is another community package available that seems to do just that but I haven't tried it yet.

Gjesse responded:

Right now these packages are generated from the discovery documents, which all support JSON defined by the JSON schema in these documents. The discovery document for Cloud Datastore v1beta2 as the only one of these APIs indicate support for protobuf response through the following information:

"alt": {
            "default": "proto",
            "description": "Data format for the response.",
            "enum": [
            "enumDescriptions": [
                "Responses with Content-Type of application/json",
                "Responses with Content-Type of application/x-protobuf"
            "location": "query",
            "type": "string"

We might add support for protobuf bodies, but it raises an issue about the generated API, as it will have to take different request/response objects - the ones generated from the associated protobuf definition file.

However, not everyone in the Dart community was on board with the one package approach.

User Bob Nystrom asked Gjesse "Out of curiosity, what benefits do you find to having them all in one package? I tend to prefer smaller packages I can mix and match".

This view was echoed by user Nathan Weizenbaum who asked "What do you think about providing a bunch of separate, separately-versioned packages as well as one "one-stop shopping" package that just depends on and re-exports all of the separate packages?"

Gjesse responded, saying:

This is an approach that we have also discussed, and it provides a path for us to split out and still keep the bundles, making it easy to get started.

The feature in pub for having private packages was coming from this, as all generated packages could share a common package that was not intended for public consumption (otherwise all these packages would contain copies of the same common code).

This might lead to the exact same version constraint issue if we break that common package.

To get started using the libraries, users should look at the GitHub repository googleapis_examples.

The Dart team invite InfoQ readers to post on the discussion group with any questions or comments on the client libraries. Bugs can be filed on GitHub projects for the generator and the googleapis_auth package.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you