i was able to fire off an alert message from dart, but couldn't figure out how to call a function I wrote in another js file from dart. This would have been a great selling point if it was straight forward. I did see this post, which got me started, but i feel there must be a way, so please share the love if you figured it out.
Here's what I've done:
Add this to yaml file:
dependencies:
js:
hosted: js
Add import statement to top of dart file: import 'package:js/js.dart' as js;
Add this bit of code to show alert message
js.scoped(() {
js.context.alert("jump for joy!");
});
Here's the part which I think should work but doesn't: given that I have a javascript function doSomething(), I should be able to call
js.context.doSomething();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…