Generating a Dart client for an App Engine Cloud Endpoints API

This article will show you how to generate a Dart client library for Google App Engine Cloud Endpoints.

First we need to download root API discovery document :

http --download https://yourapp.appspot.com/_ah/api/discovery/v1/apis/

Now we have apis.json, create a folder name discovery and put apis.json in.

mkdir discovery
mv apis.json discovery
mkdir dart_apis

Second, we will install
https://github.com/dart-lang/discoveryapis_generator

pub global activate discoveryapis_generator
pub global run discoveryapis_generator:generate package -i discovery -o dart_apis

This will create a new Dart package with generated client stubs for calling each of your API methods. The generated library can be used like any of the other Google Client API libraries.

If you want to generate a client stub code that should be integrated into an existing client you can instead do:

pub global activate discoveryapis_generator 
pub global run discoveryapis_generator:generate files -i json -o <path to existing client package>