Expose Dart functions to javascript
In Dart 2.3.0 I had to tweak the solution just a bit for allowInterop
to play nice.
import 'dart:js' as js;
main() {
String foo() {
return "bar!";
}
js.context['foo'] = js.allowInterop(foo);
}
In Dart 1.20 I had to add allowInterop()
import 'dart:js' as js;
main() {
String foo() {
return "bar!";
}
js.context['foo'] = allowInterop(foo);
}
No problem ! see Calling Dart from JavaScript.
In your case :
import 'dart:js' as js;
main() {
String foo() {
return "bar!";
}
js.context['foo'] = foo;
}