I started the js_wrapping_generator project to do something like that but its not quite ready for prime time. I used the analyzer package to parse dart files an generate other files.
You can have a look at dart_generator.dart to have a sample.
The current version is based on a simple AST and I'm working on a new version based on a resolved AST to simplify templating even more.