My server is written in Java (on GAE). It includes some data classes that I share with an Android client, and would now like to also share with a Dart web client.
By 'share' I mean that I serialize them to JSON and use HTTP or GCM to sync them between client and server.
So, I'm looking for a tool that will generate Dart equivalents for the relevant Java classes, so I don't have to create them manually.
Google Cloud Endpoints does this (converts data classes from GAE languages to client languages) but Dart is not currently amongst the support languages.
I guess GCE could be used to generate js, which could then be used in Dart app, but that is not ideal. So I think this is a possible solution but not an adequate one.
The other problem with this is that the code conversion of is tightly bound to the GCE service - it can't be used independently of GCE and the only way to get GCE to convert your classes is to include them in a GCE interface.
(If they added Dart support to GCE, made the code translator more independent of GCE, and added some features such as an @Ignore attribute, I think it would be very useful!)
You can use this package to generate Dart client code for Google Cloud Endpoints http://pub.dartlang.org/packages/discovery_api_client_generator.
I also successfully used Protocol Buffers for a similar scenario
- http://pub.dartlang.org/search?q=protobuf
- http://pub.dartlang.org/packages/protobuf_builder
See also https://developers.google.com/protocol-buffers/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With