Closed ARASHz4 closed 1 year ago
add.js function add(a, b) { return a + b; }
dart
final JavascriptRuntime runtime= getJavascriptRuntime(); int a =10; int b=20;
String addJS = await rootBundle.loadString("assets/add.js"); final add = runtime.evaluate("""$addJS\n add($a,$b);"""); debugPrint("add= ${add.stringResult}");
How to call a function with parameters from dart to js?