如何从 Flutter Web 调用 JS 函数?
How to call a JS function from Flutter Web?
我想从 Flutter Web 应用程序调用一个简单的 JS 函数:
<script>
function alertMessage(text) {
alert(text)
}
</script>
我怎样才能做到这一点?
main.dart:
void onTap(){
///This is where I want to call the JS function... alertMessage();
}
import 'dart:js';
main() => context.callMethod('alert', ['Hello from Dart!']);
我想从 Flutter Web 应用程序调用一个简单的 JS 函数:
<script>
function alertMessage(text) {
alert(text)
}
</script>
我怎样才能做到这一点?
main.dart:
void onTap(){
///This is where I want to call the JS function... alertMessage();
}
import 'dart:js';
main() => context.callMethod('alert', ['Hello from Dart!']);