Is it possible to integrate the two worlds at least on the data transfer level? Say i have Java objects which are provided through a Spring WebMVC REST endpoint and my Dart client access these resources with AJAX. It would be nice if the transfered type would be known by the Dart client aswell so i don't have to synchronize the Dart and Java version of the same type definition but the IDE could give me suggestion and errors if the data access on the client side is invalid.
EDIT
A little more explanation what i'm trying to do because it seems i was not clear enough:
- On the Java side i define a bean which is converted to JSON by Spring WebMVC + Jackson. So the transfer unit IS already JSON. I can easily access data with Dart dynamically but that's not what i want to do.
- I want to parse the retreived Data to a Dart class which as it turns out being a replicate of the original Java bean's class definition. Take a look at JsonObject's explanation on Dart's site, especially the
Language
abstract class. That's exactly what i'm doing right now. I'm defining an abstract class which defines the JSON data i'm retreiving from the server. This way Dart can give syntax errors if i'm accessing non existing fields or doing incompatible casts, etc. Of course this can still yield into a parse error but after that i can work with the data in a typed manner. - My problem is that to achieve this i have to manually synchronize the data bean's class definition on the Java side and the abstract class definition on the Dart side. I'm wondering if there's somebody working on creating something like a code generator which creates a Dart class definition from a Java class definition or so.