📜  在 Flutter 中运行 javascript - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:24.243000             🧑  作者: Mango

代码示例1
@JS() // Sets the context, which in this case is `window`
library main; // required library declaration called main, or whatever name you wish

import 'package:js/js.dart'; // Pull in our dependency

@JS('parent.jsFunction') // This marks the annotated function as a call to the function
external void jsFunction(dynamic command, dynamic arg);

void callJsFunction() {
  jsFunction('command', 'args'); // calls the function in javascript
}