1

I consider using Dart for my next web project and it has made a very neat impression on me so far. Obviously, Dart code can be converted into JavaScript. However, I wonder if this results in code where functions can be used from other JavaScript files.

danijar
  • 32,406
  • 45
  • 166
  • 297

2 Answers2

4

It is supported to call Dart functions from JavaScript but only functions that are made available to JavaScript explicitely.

See

When you build Dart to JavaScript minification and tree-shaking make it hard or mostly impossible to call methods because functions might not even be included in the output if the analysis recognized that the function isn't called anywhere and if it actually is included it will have a shortened and cryptic name.

I have seen it mentioned that here are attempts for better support of this use case but there isn't anything available yet.

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
2

If your generated JavaScript is accessible then for sure it will regardless of it is generated using dart or anything else

Umesh Aawte
  • 4,590
  • 7
  • 41
  • 51