dart_to_js_transpiler 1.0.0
dart_to_js_transpiler: ^1.0.0 copied to clipboard
Dart to JavaScript Transpiler
Dart to JavaScript Transpiler [Beta] #
Usage #
- Add package to your dependencies
- Using decorators from this library mark classes and methods you're willing to expose as JS interface
- Methods of the class that is not marked as exposed will be ignored
- Only public methods can be exposed to JS
- Using
Entrypointdecorator mark themainfunction - Run
pub run build_runner build - Add
grinderandcli_pkgto your dependencies - Following the example create a
toolfolder in the root of the project, creategrind.dartfile inside. - Create
packagefolder in the root of the project, createpackage.jsonfile following the template example- You can use
djt-codegenlib to create templated JS files with.d.tsexports as wel
- You can use
- Run
pub run grinder copy-schemato create a JS buildcd ./build/npmand runyarn && yarn codegenin order yo create interfaces
- Your Dart library is now available as the NPM package.